One observation: > print_r($query_rsCS); > if(!empty($aWHERE)); ^ Remove semi-colon ? > $query_rsCS .= ' WHERE '.implode(' AND ',$aWHERE); > print_r($aWHERE); HTH Graham -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php