• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Message: Undefined property: $db

#1
I included this line in my controller.


Code:
$countusername = count($this->db->query("SELECT * FROM users WHERE username = '$_POST[username]'")->result_array()); 


And I get this error.


Quote:Message: Undefined property: Makenew::$db


Why? I configured my database correctly.
Reply

#2
(07-10-2017, 10:13 AM)desbest Wrote: I included this line in my controller.


Code:
$countusername = count($this->db->query("SELECT * FROM users WHERE username = '$_POST[username]'")->result_array()); 


And I get this error.


Quote:Message: Undefined property: Makenew::$db


Why? I configured my database correctly.

You need to autoload it or load it manually
https://www.codeigniter.com/user_guide/d...cting.html

and

database request should be in the model
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
2 Guest(s)


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