Thanks
From: Jeremy Zawodny <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: Scot Campbell <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] Subject: Re: Unique Key Violation - How to determine which key Date: Tue, 16 Sep 2003 20:31:21 -0700
On Tue, Sep 16, 2003 at 08:25:39PM -0700, Scot Campbell wrote: > I have a table w/ a primary key and 2 additional unique keys. > > How can I determine which key was in error when a key violation occurs > (error=1062)? > > The call is issued from PHP (4.4.3). > > I can retrieve a message w/ mysql_error() which returns "Duplicate entry > '[EMAIL PROTECTED]' for key 3" > > I'd rather get the name of the unique key, in this case I named it > `IDX_EMAILADDR`. > > Any ideas? Thanks
Look at SHOW KEYS or SHOW CREATE TABLE and find the 3rd key.
Jeremy -- Jeremy D. Zawodny | Perl, Web, MySQL, Linux Magazine, Yahoo! <[EMAIL PROTECTED]> | http://jeremy.zawodny.com/
MySQL 4.0.15-Yahoo-SMP: up 3 days, processed 102,697,946 queries (378/sec. avg)
_________________________________________________________________
Get 10MB of e-mail storage! Sign up for Hotmail Extra Storage. http://join.msn.com/?PAGE=features/es
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]