I already tried using the IN argument on a Select Statement like
$sql = "SELECT * FROM msgs WHERE user1 IN ('$var1','$var2') AND user2 IN ('$var1','$var2')";
Does this work on an IF Statement as well like
if(user1 IN ('$var1','$var2') AND user2 IN ('$var1','$var2')){
And if not, is there an alternate way to achieve something similar like this in an IF Statement?
UPDATE
The msg
table somewhat looks like this :
accid | user1 | user2 | message |
1 mark edward asasdsadsad
2 edward mark asdaqwdksjadhkq
3 mark sherlock sadasdadsad
I want to make an IF STATEMENT
to identify whether user1 is mark/edward AND
user2 is mark/edward - in that way I could confirm that the two have sent messages back-and-forth. Normally I could go with IN
through SELECT
, but in this case I must really use IF
statement for some reasons. Is there anyway to do this?