$rsInsertCate = mysql_query($query_rsInsert, $myConnection) or die(mysql_error());
Now, when this line generate an error and die, is there a way to capture the error and assign that to a variable? The reason I want to do this is, if a user is uploading or query something from the database and somehow end up with an error, I want to email that error to me so I can verify why the user receive an error from the database.
//using @ to hide the error from the user
$rsInsertCate = @mysql_query($query_rsInsert, $myConnection);
if($rsInsertCate == false){
//send your email here
//just add mysql_error() into the message
$message .= 'The error was: '.mysql_error();
....
.....
die('Nice error message for the user here.');
}