My delete function doesn't work! (PM System)

Post here is you are having problems with any of the tutorials.
Post Reply
Shahlin
Posts: 49
Joined: Sat Jan 14, 2012 10:35 am

My delete function doesn't work! (PM System)

Post by Shahlin »

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 :

[syntax=php]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);

}
}[/syntax]
Just A PHP Beginner!
ExtremeGaming
Posts: 205
Joined: Mon Jul 09, 2012 11:13 pm

Re: My delete function doesn't work! (PM System)

Post by ExtremeGaming »

[syntax=php]if(mysql_num_rows($result) === 1[/syntax]
One to many ='s here
<?php while(!$succeed = try()); ?>
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: My delete function doesn't work! (PM System)

Post by jacek »

What is not working about it ? What does happen compared to what you expect ?
Image
Post Reply