Welcome Guest, Not a member yet? Register   Sign In
Still trying to link database with website
#1

[eluser]Unknown[/eluser]
Thanks for your effort to help me connect my database with my site.putting the code: $this->load->database('default'); in my controller after the constructor has still not helped.The same thing for the autoload configuration.Please permit me ask you this question.

Since the error message is about a "Call to a member function on a non-object" and is in the file which displays my page(that is view,and the error line number is pointing to the same file),does that not show that something needs to be done about:

$query = $this->db->query('SELECT name, title, email FROM my_table'); (which is the first line of the php code sending request to the database)

Please I seriously need your help
#2

[eluser]mddd[/eluser]
On that line there is only one "member function of an object" and that is $this->db->query.
You say you are using that line in your VIEW? Then that is the problem. $this->db is not available in the view. You should use it in the controller or the model!!
Get your db information there, and send the RESULT to the view to be displayed!
#3

[eluser]Georgi Budinov[/eluser]
mddd, you are not right. Using $this->db is OK from the view although it is not a good practice, of course.
ndijones, I think that you should provide the code in order someone to solve your problem!




Theme © iAndrew 2016 - Forum software by © MyBB