Jump to content

Fatal error: call to a member function on a non-object in...line 106


MA06

Recommended Posts

Hi Guys,

I get the error call to a member function on a non-object in...line 106. It seems to give me the error everytime i use the symbol:[b] ->[/b] for instance on line 106 its: [b]$item = $result->fetch_object();[/b] and in another line:[b]$result = $conn->query($query);[/b] which i took out it gave me the same error, so i assume its something to do with the symbol: [b]->[/b].

Any ideas what the problem is, thanks in advance for any help.

MA.
Link to comment
Share on other sites

[!--quoteo(post=366393:date=Apr 19 2006, 12:42 PM:name=MA06)--][div class=\'quotetop\']QUOTE(MA06 @ Apr 19 2006, 12:42 PM) [snapback]366393[/snapback][/div][div class=\'quotemain\'][!--quotec--] so i assume its something to do with the symbol: [b]->[/b].

Any ideas what the problem is, thanks in advance for any help.

MA.
[/quote]
Yes it is.

The "->" associates an object with its methods; provided that you invoked the class. Translating with an example:
[code]function show_photo()
{
   echo '<img src="' . $photos->current() . '" alt=" " />';
   // This will throw your error
}[/code]
[code]function show_photo()
{
   $photos = new PhotoClass;
   echo '<img src="' . $photos->current() . '" alt=" " />';
   // This is going to be OK if you have a function name "current()" in  PhotoClass
}[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.