Jump to content
MakeWebGames

Recommended Posts

Posted

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

Posted

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?

Posted

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

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...