* Thus wrote Chris W. Parker ([EMAIL PROTECTED]):
> Marek Kilimajer <mailto:[EMAIL PROTECTED]>
>     on Tuesday, August 26, 2003 3:59 AM said:
> 
> > mysql_query() will return true for queries that don't return rows and
> > were executed without error, so you can use
> > return mysql_query();
> 
> > You should also make a UNIQUE index on email column, then you can
> > check the number returned by mysql_errno(), one number I don't
> > remember signals duplicate entry error.
> 
> OOhhh... You know, I already HAVE done this, and I just came to the
> realization that if I've already got a constraint on the email column
> then why the heck am I checking to see if the value is already there?
> That's just a waste of resources.
> 
> I should instead just try to perform the INSERT and then if it fails I
> know I've already got a record. If it doesn't I know everything is cool.

I've debated with myself several times if this is really a good
method to not have duplicates in the database. 

Like what happens if for some reason the constraint gets dropped?
having your progam rely on the constraint will cause all data
integrity to go to hell.

Since the field is a unique index, there wont be much overhead in
the query itself.

Still undecided...

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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

Reply via email to