You could try using a separate file for configuration that uses arrays for each catgeory:
$merchandise = new Array( 1, 2, 6, 23, ... ); Then have it run a foreach loop: foreach ($merchandise as $tempVar) { $queryConditions .= "AND code = '$tempvar'"; } You need to obviously work with it a little more, but this would be a very helpful method to use. It would allow you to add a new code to the config file without having to go digging really deep through your script. Just use include() to get the config into your script. Mike "Jeff Lewis" <[EMAIL PROTECTED]> wrote in message 004301c15b1d$b9f7ab80$76a1a8c0@LEWISJCIT">news:004301c15b1d$b9f7ab80$76a1a8c0@LEWISJCIT... It's not really, but kind of, a PHP question. I mean it is being written in PHP :) I am putting together a search feature for our classified ads and there are about 4000 each day. Now I am bulding a query to search by newspaper, date, and keywords. One last thing is categories. Curious how others would handle this...on the search screen (and on the site) we have broken down the classified codes into about 8-10 main groups (stuff like Merchandise, Transportation, Services etc). Now the problem is this: in the database, each ad goes in with it's class code which matches up with the actual category. So instead of just Merchandise we have sub categories like Christmas Trees. There are close to 1500 class codeas and when I build this I need to allow the user to select just one of the 8-10 codes and have the program return everything. Will I need to do something like: if $selection="Merchandise" then { select all ads where code="2" AND code="5" AND code="123" AND code="567" etc etc } Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]