Re: multiple fields all unique? [almost solved]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John W. Holmes wrote:
[snip]
When you update the table with an existing "mac" value, the error will be
similar to "Duplicate value for Key XX" where XX is what key was duplicated.
I can't remember if the keys start at zero or one, but your ID column will
be the first key, then mac, hostname, and finally ip (in the order they were
created).

So, if you examine the result of mysql_error() and it say duplicate for key
2, then the "mac" column was duplicated.

Although this sounds a little harder than doing a SELECT prior to and just
comparing values, it lets you do this with just a single query and only have
extra processing upon errors instead of every single update.
[/snip]

Your right, I am able to see which record matches (not the record I am updating) I think you just answered my question by stating that

> Although this sounds a little harder than doing a SELECT prior to and > just
> comparing values, it lets you do this with just a single query and
> only have
> extra processing upon errors instead of every single update.


I suppose that is what I am going to have to do before doing the update. If you know of a different method please elaborate.
thanks again,
Jas


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux