Welcome Guest, Not a member yet? Register   Sign In
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

(This post was last modified: 07-10-2017, 09:26 AM by Paradinight.)

(07-10-2017, 09: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




Theme © iAndrew 2016 - Forum software by © MyBB