this code isnt workin:

$newer = mysql_query("DELETE FROM messages WHERE id = '$rawr', user = '$rew', read = '$roll'");

this code works:

$newer = mysql_query("DELETE FROM messages WHERE id = '$rawr' AND user = '$rew'");

the variable is the same that is included in the first, so its not the variable. i think i dont know how to have three of them cause i know that for two i can use the AND instead of commas.
please help i googled it and couldnt figure it out

Recommended Answers

All 4 Replies

it is not working becasue you are using , instead of and

$newer = mysql_query("DELETE FROM messages WHERE id = '$rawr' AND user = '$rew' AND read = '$roll'");

this should work

so i can use more than two ands? can i use like 5 ands?

You can use as many ANDs and ORs as you like, with as many parenthesis as you like to create as many logical sub-groupings as you like:

a AND b AND (c OR (d AND e) OR (f AND g)) ...

but be aware that at some point you cross a line where you should probably re-examine your join criteria and ask yourself why you're having to specify so much in a WHERE clause.

oh ok ive only had to specify about 3-4 tops in a where clause...
thanks. ive never user parenthesis yet.

Be a part of the DaniWeb community

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