MA06 Posted April 19, 2006 Share Posted April 19, 2006 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. Quote Link to comment Share on other sites More sharing options...
poirot Posted April 19, 2006 Share Posted April 19, 2006 [!--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] Quote Link to comment Share on other sites More sharing options...
MA06 Posted April 20, 2006 Author Share Posted April 20, 2006 Thanks for the help Poirot, managed to solve problem.MA. 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.