Jump to content
MakeWebGames

[v2] Can't delete gang forum posts/ topics


nanolimit

Recommended Posts

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!

Link to comment
Share on other sites

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']}");

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...