Jonathan Davies <> wrote:
> I am attempting to create an advanced form with 9 different search
> fields.  I am [concatenating a bunch of bits together] so I don't
> have to [create] over 300,000 IF statements.
> mysql_fetch_assoc(): supplied argument is not a valid MySQL
> result resource on line 261
> I cannot seem to hit the nail on the [head] to why it [doesn't] work. 
[snip code]

When you see that particular error message, you should print the query you're
executing, or log it, or something.  If you have more than 1 field set, it
looks like you'd be doing something like:

$q =  "select stuff1 ... order by blah1";
$q += "select stuff2 ... order by blah2";

...which gives you "select stuff1 ... order by blah1select stuff2" , which is
bad SQL syntax, which explains the error you're getting.  I am not sure
whether putting another space at the end of each substring would help, but
that's the first thing I'd try.

(I'm sure other people will say "OMGPANIC procedural code!  OH NOES, using
mysql_* functions!  Unclean!  Unclean!  AAAAAH!", so be prepared for that

Matt G / Dances With Crows
The Crow202 Blog:
There is no Darkness in Eternity/But only Light too dim for us to see

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to