|I have done a similar practice for when a mysql_query messes up.|
So I don't lose the data (that would have been modified, or changed), I made a custom function to log this data elsewhere.
mysql_query($query) or MyLog($query,mysql_error(),$_SESSION['id'])
The function simply logs the intended query, who it was suppose to be for, and the official error. It is useful to catch attempted failed inject attempts too.