nanolimit Posted November 25, 2007 Posted November 25, 2007 I'm getting these errors: Fatal error: Call to a member function query() on a non-object in /public_html/forums.php on line 703 Fatal error: Call to a member function query() on a non-object in /public_html/forums.php on line 607 This is in relation to deleting topics/ posts in the gang forums function delepost() { global $ir, $c, $userid, $h, $bbc, $db; if($ir['user_level'] < 2) { die(""); } $q3=$db->query("SELECT * FROM forum_posts WHERE fp_id={$_GET['post']}"); $post=$db->fetch_row($q3); $q=$db->query("SELECT * FROM forum_topics WHERE ft_id={$post['fp_topic_id']}"); $topic=$db->fetch_row($q); $u=mysql_escape($post['fp_poster_name']); $db->query("DELETE FROM forum_posts WHERE fp_id={$post['fp_id']}"); print "Post deleted... "; recache_topic($post['fp_topic_id']); recache_forum($post['fp_forum_id']); stafflog_add("Deleted post ({$post['fp_subject']}) in {$topic['ft_name']}"); } function deletopic() { $q=$db->query("SELECT * FROM forum_topics WHERE ft_id={$_GET['topic']}"); $topic=$db->fetch_row($q); $db->query("DELETE FROM forum_topics WHERE ft_id={$_GET['topic']}"); $db->query("DELETE FROM forum_posts WHERE fp_topic_id={$_GET['topic']}"); print "Deleting topic... Done "; recache_forum($topic['ft_forum_id']); stafflog_add("Deleted topic {$topic['ft_name']}"); } I've done alot of searching but couldn't find anything on it (with an answer), any help would be great :-D Thanks! Quote
UCC Posted November 25, 2007 Posted November 25, 2007 Re: [v2] Can't delete gang forum posts/ topics Off a quick look, I dont see a glaring problem. It might help if you posted exactly what line 703 and like 607 is. My forums are highly modified so I cant use my line counts to check Quote
nanolimit Posted November 25, 2007 Author Posted November 25, 2007 Re: [v2] Can't delete gang forum posts/ topics This is the section (thought it might help abit more with the whole section) 603: function recache_topic($forum) 604: { 605: global $ir, $c, $userid, $h, $bbc; 606: print "Recaching topic ID $forum ... "; 607: $q=$db->query("SELECT p.* FROM forum_posts p WHERE p.fp_topic_id=$forum ORDER BY p.fp_time DESC LIMIT 1"); 608: if(!$db->num_rows($q)) 609: { 610: $db->query("update forum_topics set ft_last_id=0, ft_last_time=0, ft_last_name='N/A',ft_posts=0 where ft_id={$forum}"); 611: print " ... Done"; 612: } 701: function deletopic() 702: { 703: $q=$db->query("SELECT * FROM forum_topics WHERE ft_id={$_GET['topic']}"); 704: $topic=$db->fetch_row($q); 705: $db->query("DELETE FROM forum_topics WHERE ft_id={$_GET['topic']}"); 706: $db->query("DELETE FROM forum_posts WHERE fp_topic_id={$_GET['topic']}"); 707: print "Deleting topic... Done "; 708: recache_forum($topic['ft_forum_id']); 709: stafflog_add("Deleted topic {$topic['ft_name']}"); Quote
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.