Stuart Felenstein wrote:
No sorry to say that isn't it. It seems that for every field i submit in the search, it's the field right after where the syntax error is reported. So , maybe it's not truly a syntax error.
Print out the entire query before you run it. Syntax errors are usually pretty obvious. If not, post the actual query here.
Just to reiterate (and it's like 75 lines of code, so I'm going to spare the group)
$aWHERE = array();
$query_rsCS = "SELECT .........[the rest of the select]................."
//Here are the clauses for the dynamic query //There are 50+ so, this is how they are written if(isset($workAuth)) $aWHERE[] = "Prof.WorkAuth IN ($workAuth)";
So what's the value of $aWHERE after all 50 of these? print_r($aWHERE) shows what?
if(!empty($aWHERE));
//This is how I attach the where clauses where user //has chosen a field $query_rsCS .= ' WHERE '.implode(' AND ',$aWHERE);
And what's the value of $query_rsCS here? Print it out.
Now I've printed out the query, but it only prints out right up to the where clause. To me it looks like the where clause is not taking correctly but I'm not sure why or how to know for usre. I'm tried print_r ($query_rsCS) but it's returning nothing. Either it's empty for some reason, or the suppposed syntax error is stopping it.
Where exactly are you printing out $query_rsCS that it's empty? You assign a static value to begin with, so it can't be empty unless you're doing something to it.
This smells of a scope issue to me, where you're creating $query_rsCS and $aWHERE in one function and then trying to access it in another without declaring it global first.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php