MySQL update
| From: | Matthew Oatham | Date: | Tue, 24 Feb 2004 15:40:12 +0000 |
| Subject: | MySQL update | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-178709@lists.php.net to get a copy of this message | ||
Hi,
I have an update statement that tries to update a number of values - these values have unique value
constraint so when I do the update it will either succeed or fail. If it fails how can I determine
where the update failed. i.e. pinpoint the value that was not unique?
At the moment I am doing ...
$sql = mysql_query("UPDATE dis_user SET first_name = '$firstName', last_name =
'$lastName', email_address = '$emailAddress' WHERE user_id =
'$userId'");
if(!$sql) {
echo "Data not inserted due error";
}
How can I improve on the above to give specific error information.
Thanks
Matt