Re: Creating an Advanced Form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Davies <jonny1davies@xxxxxxxxxxxxxx> 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
too....)

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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux