I'm getting an error with a CREATE table query. I know what the problem is (I'm creating tables dynamically and now and then a name slips through with a space or other illegal character.) The error occurs in a function and what I want to know is, is there a system field/flag which I can use after the return in an if statement to detect whether an error has taken place or not. Thanks, Mike
You can use a try catch coding style to get and/or log your errors. Assuming php - http://php.net/manual/en/language.exceptions.php You can also use simple logic to throw or log the error, but not kill the script. if(!$query) { log(mysql_error()); } PHP: Or you could make a simple script to collect the errors and display them at the end. if(!$query) { $errors[] = mysql_error(); } //At the end of the script if($errors) { foreach($errors as $key => $error) { echo $error; } } PHP: