$sql = 'SELECT pt.post_subject, f.forum_name FROM '.POSTS_TEXT_TABLE.' pt, '.POSTS_TABLE.' p, '.FORUMS_TABLE.' f WHERE pt.post_id="'.$post_id.'" AND p.post_id=pt.post_id AND p.forum_id=f.forum_id';
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, "Couldn't get post subject information".$sql);
$subject = $db->sql_fetchrow($result);
$post_subject=$subject['post_subject'];
$forum_name=$subject['forum_name'];
$sql = 'UPDATE ' . POSTS_TABLE . ' SET post_bluecard="0" WHERE post_id="'.$post_id.'"';
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, "Couldn't update blue card information");
$sql = 'SELECT f.forum_name, p.topic_id FROM '.POSTS_TABLE.' p, '.FORUMS_TABLE.' f WHERE p.post_id="'.$post_id.'" AND p.forum_id=f.forum_id';
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, "Couldn't get post subject information");
$post_details = $db->sql_fetchrow($result);
$forum_name=$post_details['forum_name'];
$topic_id=$post_details['topic_id'];
$sql = 'SELECT pt.post_subject FROM '.POSTS_TEXT_TABLE.' pt, '.TOPICS_TABLE.' t WHERE t.topic_id="'.$topic_id.'" AND pt.post_id=t.topic_first_post_id';
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, "Couldn't get topic subject information".$sql);
$post_details = $db->sql_fetchrow($result);
$post_subject=$post_details['post_subject'];
$sql = 'SELECT p.topic_id FROM '.POSTS_TEXT_TABLE.' pt, '.POSTS_TABLE.' p WHERE pt.post_subject="('.$post_id.')'.$post_subject.'" AND pt.post_id=p.post_id';
if( !$result = $db->sql_query($sql) )
message_die(GENERAL_ERROR, "Couldn't get topic subject information".$sql);