Adjusting sql statement in a function based upon input

Posted by Stefan on Stack Overflow See other posts from Stack Overflow or by Stefan
Published on 2010-05-03T03:26:43Z Indexed on 2010/05/03 3:38 UTC
Read the original article Hit count: 458

Filed under:
|
|
|
|

Hey there, This is a bit urgent!

I'm trying to make a simple filter search where-by you can choose from a series of 3 drop downs and then based upon this the results are then displayed, How would I go about adjusting the sql query for each and if you were to only choose to search from aone of the 3 rather than all 3 etc... example there could be the url with input such as: url.com?location=gb&color=3&hair=4 and still form the correct sql query for something like this: url.com?location=gb&hair=1 and not encounter problems with WHERE and AND etc etc and empty variables in the statement

Would this not need to be a massive function to check using if to see how the data is set for all possibilities?

Thanks, Stefan

© Stack Overflow or respective owner

Related posts about sql

Related posts about php