I'm developing a personal messaging system and I need to list the messages I've received and the messages I've sent, but I'm having difficulties, because the code I've just got can pick up all that I've sent or all that I've received and never both. The code I'm using
<?php
$query = mysql_query("SELECT pr.id_perfil, pr.id_perfil_enviou, pr.recado, pe.nome as NomeEnviou, prm.nome as NomeRecebeu FROM perfil_recados AS pr INNER JOIN perfil AS pe ON pe.id = pr.id_perfil_enviou INNER JOIN perfil AS prm ON prm.id=pr.id_perfil WHERE (pr.id_perfil='961' AND pr.id_perfil_enviou = '15') OR (pr.id_perfil='15' AND pr.id_perfil_enviou = '961')");
while($exe = mysql_fetch_array($query)){
echo 'De: '.$exe['NomeEnviou'].' para '.$exe['NomeRecebeu'];
}
?>