I have this method, part of a custom MySQL class, that handles updates, inserts, and deletes, and when there's a problem running mysql_query(), it doesn't return an error. I want the error to be displayed when the argument passed over ($debug) is equal to 1, otherwise, don't show the error on the page. This is my code
// Used for Updates, Insertions, Deletions
function SQLUpdate($sql, $debug=0) {
// Check that it is in fact an UPDATE, INSERT, or DELETE statement
if(eregi("^update |insert |delete ", $sql)) {
if($debug==1) {
$query = mysql_query($sql);
}
else {
@$query = mysql_query($sql);
}
if (!$query) {
echo $this->error_message.$this->sqlupdate_message;
exit;
}
return true;
}
}
Any thoughts? Any help is appreciated. Thanks!