On Thu, Sep 18, 2003 at 08:20:00AM -0700, Scot Campbell wrote:
> O.K., I understand. And I have always coded in this manner.
>
> Throw the data at the system and see if it sticks. In most cases it will.
>
> However, when it does fail, it would be nice to determine the error w/o
> issuing more
lated, issue
selects for each of the unique contrained columns to determine which one was
violated"?
Thanks
From: Jeremy Zawodny <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: Scot Campbell <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: Unique Key Violation - How
On Wed, Sep 17, 2003 at 03:07:41PM -0700, Scot Campbell wrote:
> These will be random atomic Inserts originating from a Web page.
>
> I'm not sure I catch your drift. The inserts are not in a batch.
>
> I need to notify the user on the page which field was in error. I'd like to
> refer to the
ns the non-duplicate data (i.e., error message on the email address
vs. error message on the userid field).
From: Jeremy Zawodny <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: Scot Campbell <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: Unique Key Violation - How to de
On Wed, Sep 17, 2003 at 08:01:07AM -0700, Scot Campbell wrote:
> Let me rephrase. I insert a row and recieve a 1062 error (Key violation).
> How do I determine, at run-time, which of the 3 possible columns has the
> error. I guess I could parse the mysql_error message string. But, that
> see
uniqueness via individual selects before I issue the insert.
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
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/ mysq
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 r