List:General Discussion« Previous MessageNext Message »
From:<ross Date:March 8 2006 10:12am
Subject:query problem
View as plain text  
I am fairly new to sql and am now getting into the area of slightly more 
complex queries.

At present my query is

 $query = "SELECT * FROM $table_name WHERE sname LIKE '$search_string%' 
ORDER BY fname $type";

but I have two other filters which may or may not be chosen. (area, and 
interest).

 $query = "SELECT * FROM $table_name WHERE sname LIKE '$search_string%' AND 
area='area' AND interest='interest' ORDER BY fname $type";

but what if nether is chosen, or only one? Is there an AND/OR operator or 
similar in mysql?


Thanks,

Ross 

Thread
Data type in MySQL / ASP.netDewald Troskie29 Nov
  • Re: Data type in MySQL / ASP.netStephen Moretti29 Nov
  • query problemross8 Mar
    • Re: query problemPeter Brawley8 Mar
    • Re: query problemDon Read12 Mar