I have this PM system, where users can write each other. When I show the available PM's I have in my MySQL table deleted_sender and deleted_receiver
If the deleted_sender is 1, then the person who sent the PM shouldn't be able to see it in the list. If the deleted_receiver is 1, then the person who received the PM shouldn't be able to see it.
My question is, how can I do this with a mysql query? Currently I have this:
$r=mysql_query("
SELECT * FROM private_messages
WHERE
sender_id='".$userdata['id']."'
OR
receiver_id='".$userdata['id']."'
AND
(deleted_receiver='0' OR deleted_sender='0')");
Although, this just shows the PM at both the sender and the receiver.
$userdata['id']is sender then query withdeleted_sender =0vice versa for receiver