You can't....

well, not via PHP anyway. You would need to do a select first to establish
if any of these values exist in the database. Something like...

select first,last,email from mytable where first=x or last=y or email=z;

then check which one of first,last,email is non-empty.

BUT.. do you *realy* want firstname and lastname to be unique??

HM

 

Matthew Oatham wrote:

> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to