• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Call $this->db from initController in __construct?

#3
donpwinston is right. That way you'll be able to see the errors. However I can tell you one right off the bat.

The $this->db doesn't work like you're used to in previous versions of CI. There is no more CI "superobject". You need to instantiate the things you need by calling new ClassName() and the like. For databases, there's the quick connection method of:

Code:
$db = db_connect();
$dbData = $db->query("SELECT * FROM myTable");
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply


Messages In This Thread
RE: Call $this->db from initController in __construct? - by kilishan - 06-14-2019, 08:10 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.