I trying to user 3 AND operators in one Select Statement. It's not working.
Is this even posable.
If not, any suggestions?
Here is the code:

$query_Recordset1 = "SELECT * FROM user JOIN message WHERE message.user2 = '$user2' AND message.user_id = '$user2' AND email = '$email'";


Recommended Answers

All 2 Replies

Multiple ANDs are legitimate and should work OK. However usually tables are joined on some matching fields so your query should also contain ON keyword. Do you get any errors running the query in phpmyadmin?

SELECT * FROM user JOIN message

A JOIN requires an ON to link both tables correctly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.