why is the $this->db not available in a certain module? |
I believe there is a function deviation. The code is self-explanatory: it must be used to connect to a database. Unlike $db = $this->db; which can only be used in Controllers/Models, since "$this->" cannot be used in a non-object context.
Although not recommended if you want to make a query outside the Model/Controller you can use it: PHP Code: $db = db_connect(); https://codeigniter.com/user_guide/datab...cting.html I insist: I'm talking about CodeIgniter 4! This option, db_connect();, is exclusive to CI4. https://codeigniter.com/userguide3/datab...cting.html |
Messages In This Thread |
why is the $this->db not available in a certain module? - by richb201 - 04-23-2021, 01:04 PM
RE: why is the $this->db not available in a certain module? - by wdeda - 04-23-2021, 02:23 PM
RE: why is the $this->db not available in a certain module? - by richb201 - 04-23-2021, 04:48 PM
RE: why is the $this->db not available in a certain module? - by kenjis - 04-23-2021, 06:14 PM
RE: why is the $this->db not available in a certain module? - by InsiteFX - 04-23-2021, 08:43 PM
RE: why is the $this->db not available in a certain module? - by richb201 - 04-24-2021, 03:50 AM
RE: why is the $this->db not available in a certain module? - by wdeda - 04-24-2021, 06:14 AM
RE: why is the $this->db not available in a certain module? - by richb201 - 04-24-2021, 06:38 AM
RE: why is the $this->db not available in a certain module? - by InsiteFX - 04-24-2021, 08:42 PM
|