How to delete a message in PHP and MySQL? -
how can user delete message sends or other user sends? message should shown in conversation of 1 hasn't deleted message.
if($action == 'delete_mess') { $hash=$_get['hash']; $mess_id=$_get['mess_id']; $mess_query=mysql_query("select * messages hash = '$hash'"); while($check_mess = mysql_fetch_assoc($mess_query)) { $from = $check_mess['from_id']; $to = $check_mess['to_id']; } if ($from == $session_user_id) { mysql_query("update messages set from_del = 1 `id` = '$mess_id' "); } else { mysql_query("update messages set to_del = 1 `id` = '$mess_id' "); } header('location: messages.php?hash='.$hash); }
hash conversation id started.
Comments
Post a Comment