My delete function doesn't work! (PM System)
Posted: Thu Jan 24, 2013 8:54 pm
I'm done with the whole PM system. Only thing that's not working is the delete conversation feature. Here's my delete_conversation function :
function delete_conversation($conversation_id){ $conversation_id = (int)$conversation_id; $sql = "SELECT DISTINCT `conversation_deleted` FROM `conversations_members` WHERE `user_id` != {$_SESSION['user_id']} AND `conversation_id` = {$conversation_id}"; $result = mysql_query($sql); if(mysql_num_rows($result) === 1 && mysql_result($result, 0) == 1){ mysql_query("DELETE FROM `conversations` WHERE `conversation_id` = {$conversation_id}"); mysql_query("DELETE FROM `conversations_members` WHERE `conversation_id` = {$conversation_id}"); mysql_query("DELETE FROM `conversations_messages` WHERE `conversation_id` = {$conversation_id}"); } else { $sql = "UPDATE `conversations_members` SET `conversation_deleted` = 1 WHERE `conversation_id` = {$conversation_id} AND `user_id` = {$_SESSION['user_id']}"; mysql_query($sql); } }