chromed Posted May 17, 2008 Share Posted May 17, 2008 Ok, I'm not sure whether this is the right section, and if it's not please could a mod/admin move please. I'm getting the following error from a php script Fatal error: Call to a member function query() on a non-object Can somebody please tell me what this means. ~Chromed Quote Link to comment Share on other sites More sharing options...
Spudinski Posted May 17, 2008 Share Posted May 17, 2008 Re: Fatal error: Call to a member function query() on a non-object Please post your script, it is much easier to read teh script than for someone to explain it. A common problem: Is $db declared in your script? Quote Link to comment Share on other sites More sharing options...
chromed Posted May 17, 2008 Author Share Posted May 17, 2008 Re: Fatal error: Call to a member function query() on a non-object yeah $db is in the script, and I only want to know what it means, so I can have a go at fixing it myself Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted May 18, 2008 Share Posted May 18, 2008 Re: Fatal error: Call to a member function query() on a non-object Add above that line: global $db; Quote Link to comment Share on other sites More sharing options...
Floydian Posted May 19, 2008 Share Posted May 19, 2008 Re: Fatal error: Call to a member function query() on a non-object Here's what that means (this is what the tc was asking for folks...) Fatal error: Call to a member function query() on a non-object somewhere in the code, a function is called by the name of "query();". This function has not been defined. Sample function definition: function query() { echo "Our function: query, is now defined."; } Another way to go about defining it, would be within the context of a class. If you are using the mccodes vs database class "$db" then the method called "query()" is part of that class. $db->query(); if you leave out the $db-> and just put query(), or $db is not in the "scope" where you used $db at, then you'll get this error. Define query(), and you're problem is solved. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.