how do i do three WHERE clauses with php (mysql)

Reply

Join Date: Apr 2009
Posts: 290
Reputation: SKANK!!!!! is an unknown quantity at this point 
Solved Threads: 2
SKANK!!!!!'s Avatar
SKANK!!!!! SKANK!!!!! is offline Offline
Posting Whiz in Training

how do i do three WHERE clauses with php (mysql)

 
0
  #1
Jun 12th, 2009
this code isnt workin:
  1. $newer = mysql_query("DELETE FROM messages WHERE id = '$rawr', user = '$rew', read = '$roll'");
this code works:
  1. $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
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 48
Reputation: yilmazhuseyin is an unknown quantity at this point 
Solved Threads: 5
yilmazhuseyin's Avatar
yilmazhuseyin yilmazhuseyin is offline Offline
Light Poster

Re: how do i do three WHERE clauses with php (mysql)

 
0
  #2
Jun 12th, 2009
it is not working becasue you are using , instead of and
  1. $newer = mysql_query("DELETE FROM messages WHERE id = '$rawr' AND user = '$rew' AND read = '$roll'");
this should work
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 290
Reputation: SKANK!!!!! is an unknown quantity at this point 
Solved Threads: 2
SKANK!!!!!'s Avatar
SKANK!!!!! SKANK!!!!! is offline Offline
Posting Whiz in Training

Re: how do i do three WHERE clauses with php (mysql)

 
0
  #3
Jun 15th, 2009
so i can use more than two ands? can i use like 5 ands?
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,506
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 521
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: how do i do three WHERE clauses with php (mysql)

 
0
  #4
Jun 15th, 2009
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:
  1. 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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 290
Reputation: SKANK!!!!! is an unknown quantity at this point 
Solved Threads: 2
SKANK!!!!!'s Avatar
SKANK!!!!! SKANK!!!!! is offline Offline
Posting Whiz in Training

Re: how do i do three WHERE clauses with php (mysql)

 
0
  #5
Jun 15th, 2009
oh ok ive only had to specify about 3-4 tops in a where clause...
thanks. ive never user parenthesis yet.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC