SQL - 将mysql_error发送到电子邮件帐户

I am doing a synchronizer for a personal database with php. The sync is running automatically.

I am not knowing if the sync have an errors doing selects, inserts, updates or deletes. For this reason, I need to send a notice by email indicating the result of mysql_error.

An example of the sql script is the following:

mysql_query("UPDATE `Order` SET statusId='".$order["orders_status_id"]."' WHERE id=".$orderId) or die('Error al actualizar el status de la orden '.$orderId.': '.mysql_error());;

Regards

Like this way...

mail('youremailaddress@site.com','error',mysql_error());

Try this. Look for semicolon in the end of first line.

mysql_query("UPDATE `Order` SET statusId='".$order["orders_status_id"]."' WHERE id=".$orderId);

$error = 'Error al actualizar el status de la orden '.$orderId.': '.mysql_error();

mail('youremailaddress@site.com','error',$error);