Re: newbie help

From: Date: Sun, 25 Mar 2001 18:39:23 +0000
Subject: Re: newbie help
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-7779@lists.php.net to get a copy of this message
In article <B6E3F17A.10F21%m@threezero.co.uk>, m@threezero.co.uk (Matt Coyne) wrote: > I have been trying to detect if the variable holds any value and then > building a query by concatenating like this: if(!empty($foo)) { ... } > $result=@mysql_query($concatsql, $connection) or die ("bugger...!"); > > This just dies on mysql_query. $result=@mysql_query($concatsql, $connection) or die (mysql_error() . " from query <br>\n$concatsql"); //show as much relevant info as possible When building complex queries like this, it's really easy to miss a missing quote or extra comma, etc. Displaying the query string usually makes it quite obvious where the problem lies (especially when coupled with a MySQL error message, since MySQL is pretty good about pointing out the spot where the syntax fails). -- CC

« previous php.db (#7779) next »