BIG PROBLEM WITH SEARCH!!!!!!

From: Date: Fri, 19 Jan 2001 23:22:44 +0000
Subject: BIG PROBLEM WITH SEARCH!!!!!!
Groups: php.general 
Request: Send a blank email to php-general+get-35750@lists.php.net to get a copy of this message
I'm developing a site that requires people to sign up. During this time, we get their name, email, city, etc. There is also optional informational like (age, education) that they don't have to fill in. Now, the problem we have is we allow people search through the database using mostly the same criteria people filled in during their sign up. However, if someone does not have a preference in Education or age, how do we create a query that selects all the records. Currently, the SQL statement has several "OR" clauses in between the optional fields (ie: select * form clients where (CID='$CID' AND CUserName='$CUserName') OR CAge='$CAge' OR CEducation='$CEducation'). You can see from the query that if someone has no preference, it will take the value from the form and search just on that value - NOT everything. I'm stumped on how to solve this problem. Can anyone help me out? Thanks, Mike

« previous php.general (#35750) next »