0
I need to select All messages sent by user 1 to user 2 and know the messages sent from user 2 to user 1. I am unable to mount the SQL query for the situation described.
Message table:
IdMsg, IdUserFrom, IdUSerTo, Data, Mensagem
Sql that I use only lists the Mensagen sent from user 1 to user 2. All attempts to know the messages sent from user 2 to user 1 that I try to do does not work Being:
$iduserfrom = 1 e IdUserTo = 2
SQL :
SELECT * FROM mensagem WHERE IdUserFrom = $iduserfrom AND IdUserTo = $iduserto
the code seems correct, just exchange 1 for 2 in the second query. you want to make two same queries or list all in one query only?
– Italo Rodrigo
@Italorodrigo, this is the question, I want to do everything in the same consultation, in two I get in a no.
– lelopes