Jump to content

Archived

This topic is now archived and is closed to further replies.

MA06

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

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.

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites
Thanks for the help Poirot, managed to solve problem.

MA.

Share this post


Link to post
Share on other sites

×

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.