In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Matt Coyne) wrote:

> I have been trying to detect if the variable holds any value and then
> building a query by concatenating like this:


> $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).


PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to