From: "Curt Zirzow" <[EMAIL PROTECTED]>

> > 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.

For one little script inserting into it's own little table, yeah, it really
doesn't matter.

Consider, though, a business making use of this database not only through a
PHP script, but through an Access frontend in marketing, some ASP scripts in
HR, etc. Now, if you don't enforce the constraints in the database, each and
every program must enforce the constraits itself. It's easier to do it in
one place. :)

---John Holmes...

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

Reply via email to