Jump to content


Photo

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


  • Please log in to reply
2 replies to this topic

#1 MA06

MA06
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 19 April 2006 - 12:42 PM

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: -> for instance on line 106 its: $item = $result->fetch_object(); and in another line:$result = $conn->query($query); which i took out it gave me the same error, so i assume its something to do with the symbol: ->.

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

MA.

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 19 April 2006 - 02:24 PM

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

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:
function show_photo()
{
   echo '<img src="' . $photos->current() . '" alt=" " />';
   // This will throw your error
}
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
}

~ D Kuang

#3 MA06

MA06
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 20 April 2006 - 11:08 AM

Thanks for the help Poirot, managed to solve problem.

MA.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users