Looks like your $expLevl value is empty. It's probably set, but has no value in it. Check that. -TG > -----Original Message----- > From: Stuart Felenstein [mailto:stuart4m@xxxxxxxxx] > Sent: Thursday, December 02, 2004 1:46 PM > To: php-db@xxxxxxxxxxxxx > Subject: 5 hours later - sql error. > > > I'm running into a syntax error: > > You have an error in your SQL syntax. Check the manual > that corresponds to your MySQL server version for the > right syntax to use near ') AND Prof.WorkExp IN () AND > Prof_Industries. > > Now I printed out the query and that works as I dumped > it into a mysql client and it returned correctly. > > Maybe I can get by here with out all the code. > Basically I do a select of all the tables, then the > joins. No where condition yet. This is a dynamic > query - > > After the sql I have > > $aWHERE = array(); > > if(isset($resAge)) $aWHERE[] = "Prof_Rez.Age >= > DATE_SUB(CurDate(), Interval($resAge) DAY)"; > if(isset($workAuth)) $aWHERE[] = "Prof.WorkAuth IN > ($workAuth)"; > if(isset($expLevel)) $aWHERE[] = "Prof.WorkExp IN > ($expLevel)"; ..............etc. > > $query_rsCS .= ' WHERE '.implode(' AND ',$aWHERE); > > Anyway while I basically took this code from a search > that is working - what I wonder is if the where > statement is correct . > > Well let me start here and see. > Thank you > Stuart > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php