seany123 Posted November 14, 2009 Share Posted November 14, 2009 Fatal error: Call to a member function fetchrow() on a non-object on line 30 The strange thing is that this didnt happen before i moved to localhost... anyway here is the code... $query0 = $db->execute("select * from `spylog` where `player_id`=? order by `time` desc limit 20", array($player->id)); while($spy = $query0->fetchrow()) { thanks Quote Link to comment https://forums.phpfreaks.com/topic/181546-fatal-error-call-to-a-member-function-fetchrow/ Share on other sites More sharing options...
Andy-H Posted November 14, 2009 Share Posted November 14, 2009 Are you using PDO? $stmt = $db->prepare("select * from `spylog` where `player_id`=? order by `time` desc limit 20"); $stmt->execute(array($player->id)); while($spy = $stmt->fetch(PDO::FETCH_NUM)) { Quote Link to comment https://forums.phpfreaks.com/topic/181546-fatal-error-call-to-a-member-function-fetchrow/#findComment-957618 Share on other sites More sharing options...
seany123 Posted November 14, 2009 Author Share Posted November 14, 2009 Are you using PDO? $stmt = $db->prepare("select * from `spylog` where `player_id`=? order by `time` desc limit 20"); $stmt->execute(array($player->id)); while($spy = $stmt->fetch(PDO::FETCH_NUM)) { whats PDO? Quote Link to comment https://forums.phpfreaks.com/topic/181546-fatal-error-call-to-a-member-function-fetchrow/#findComment-957619 Share on other sites More sharing options...
Andy-H Posted November 14, 2009 Share Posted November 14, 2009 It stands for PHP Data Objects, basically it's an abstraction layer for PHP to communicate with your chosen query language. I assume that since you dont know what it is, your not using it... Basically it allows you to chane the query language used on your website without having to make drastic changes to your PHP code. If you wish to look into it and perhaps learn how to use it it';s in the manual. PDO I first saw it used in Rasmus Lerdorfs toys page in his post about using Oauth to post to twitter. http://toys.lerdorf.com/archives/50-Using-pecloauth-to-post-to-Twitter.html#extended Quote Link to comment https://forums.phpfreaks.com/topic/181546-fatal-error-call-to-a-member-function-fetchrow/#findComment-957622 Share on other sites More sharing options...
seany123 Posted November 15, 2009 Author Share Posted November 15, 2009 It stands for PHP Data Objects, basically it's an abstraction layer for PHP to communicate with your chosen query language. I assume that since you dont know what it is, your not using it... Basically it allows you to chane the query language used on your website without having to make drastic changes to your PHP code. If you wish to look into it and perhaps learn how to use it it';s in the manual. PDO I first saw it used in Rasmus Lerdorfs toys page in his post about using Oauth to post to twitter. http://toys.lerdorf.com/archives/50-Using-pecloauth-to-post-to-Twitter.html#extended i dont need that for the above to work surely. Quote Link to comment https://forums.phpfreaks.com/topic/181546-fatal-error-call-to-a-member-function-fetchrow/#findComment-957676 Share on other sites More sharing options...
Andy-H Posted November 15, 2009 Share Posted November 15, 2009 No, ofcourse not but showing the code for your database class would help alot... Quote Link to comment https://forums.phpfreaks.com/topic/181546-fatal-error-call-to-a-member-function-fetchrow/#findComment-957728 Share on other sites More sharing options...
Philip Posted November 15, 2009 Share Posted November 15, 2009 Either your query is failing, or your DB class isn't returning an object into $query0 Quote Link to comment https://forums.phpfreaks.com/topic/181546-fatal-error-call-to-a-member-function-fetchrow/#findComment-957745 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.