Welcome Guest, Not a member yet? Register   Sign In
Mind Bending Error
#1

[eluser]JasonS[/eluser]
This should be really simple but I cannot work it out.

This is my error.

Quote:Fatal error: Call to a member function update() on a non-object in /Applications/XAMPP/xamppfiles/htdocs/wpp/admin/system/application/controllers/pages.php on line 65

This is my code.

Code:
65. $this->db->update($this->jdb->table, $this->db, "id='$id'");

The database library is loaded, I can add pages to my site, I can list pages. For some reason, when I run this update function I get the error. Its pretty late where I am, maybe my brain is a bit fried but I have been staring at this for ages and cannot see what is wrong.
#2

[eluser]Colin Williams[/eluser]
The database is available in the other contexts, but is it for some reason unavailable in this context?

It is odd to me that you have $this->db as a second parameter. There is a good chance you are mistakenly overwriting the $this->db reference to the Database class with your own data.
#3

[eluser]Dam1an[/eluser]
If you have a constructor, are you calling the parent one? If not, it won't have any idea what $this->db is
#4

[eluser]JasonS[/eluser]
*sigh*

Thanks a lot guys. Completely overlooked the fact that the db variable would overwrite the function. I needed the db variable to be availible to whole class and thus just added a $this-> in front of it.. Duh Smile




Theme © iAndrew 2016 - Forum software by © MyBB