Welcome Guest, Not a member yet? Register   Sign In
Call $this->db from initController in __construct?
#1

Hi,

is it possible to use $this->db in controller in __construct function from BaseController?
This is my code:

PHP Code:
    public function __construct()
    {

        
$data = [];

        
$dbData $this->db->query("SELECT * FROM myTable");
        
$resultBots $dbData->getResultArray();



    } 

However, I get a "We hit a snag" error.
Reply


Messages In This Thread
Call $this->db from initController in __construct? - by Smil3y - 06-14-2019, 03:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB