Making $db available globally |
Taken from https://codeigniter.com/user_guide/datab...cting.html
Quote:You can connect to your database by adding this line of code in any function where it is needed, or in your class constructor to make the database available globally in that class. When i do exactly that: Code: <?php ErrorException Undefined variable $db I also tried adding it into the BaseController which im trying to use as Ci3's version of an autoloader but i get the same error Code: public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) Kindly point me in the right direction. |
Messages In This Thread |
Making $db available globally - by CodingInCodeigniter - 10-15-2021, 09:53 AM
RE: Making $db available globally - by includebeer - 10-16-2021, 06:56 AM
RE: Making $db available globally - by sr13579 - 10-16-2021, 04:50 PM
RE: Making $db available globally - by iRedds - 10-16-2021, 09:11 PM
RE: Making $db available globally - by donpwinston - 10-17-2021, 12:55 AM
RE: Making $db available globally - by includebeer - 10-17-2021, 04:28 AM
|