juelpatwary Posted June 10, 2008 Share Posted June 10, 2008 If i go to move or delete a topic in my forum ( DBS V2 ) it comes up this error Call to a member function query() on a non-object in /home/beasther/public_html/forums.php on line 629 On line 629 is $q=$db->query("SELECT * FROM forum_topics WHERE ft_id={$_GET['topic']}"); 5 lines above 629 global $ir, $c, $userid, $h, $bbc; if($ir['user_level'] < 2) { die(""); } 5 lines below 629 $topic=$db->fetch_row($q); $q2=$db->query("SELECT * FROM forum_forums WHERE ff_id={$_POST['forum']}"); $forum=$db->fetch_row($q2); $db->query("UPDATE forum_topics SET ft_forum_id={$_POST['forum']} WHERE ft_id={$_GET['topic']}"); $db->query("UPDATE forum_posts SET fp_forum_id={$_POST['forum']} WHERE fp_topic_id={$_GET['topic']}"); If needed. Please help, Thanks Quote Link to comment Share on other sites More sharing options...
POG1 Posted June 10, 2008 Share Posted June 10, 2008 Re: Call to a member function query() on a non-object - Error in my forum try $q=mysql_query("SELECT * FROM forum_topics WHERE ft_id=".$_GET)or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
Floydian Posted June 10, 2008 Share Posted June 10, 2008 Re: Call to a member function query() on a non-object - Error in my forum pog is right alternatively, you can leave that the same, and add $db to the global list global $ir, $c, $userid, $h, $bbc, $db; Quote Link to comment Share on other sites More sharing options...
Ragnar Posted June 11, 2008 Share Posted June 11, 2008 Re: Call to a member function query() on a non-object - Error in my forum Thanks. For me, adding $db fixed the deleting posts error. When trying to delete the thread, I get Fatal error: Call to a member function on a non-object in /home/virtual/site7/fst/var/www/html/forums.php on line 707 $r=$db->fetch_row($q); which is at $db->query("UPDATE forum_topics SET ft_locked=-ft_locked+1 WHERE ft_id={$_GET['topic']}"); $q=$db->query("SELECT * FROM forum_topics WHERE ft_id={$_GET['topic']}"); $r=$db->fetch_row($q); print "{$r['ft_name']}'s lock status changed, if it was unlocked, it will now be locked, otherwise, it will be unlocked."; if($r['ft_locked']==0) { stafflog_add("Unlocked Topic {$r['ft_name']}"); Even though locking works just fine! 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.