Re: Adding Records & Capture The New Record ID

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

 



At 9:54 AM -0500 2/9/09, Andrew Ballard wrote:
You are right, but the point is that if you intend something to be
unique then you should declare it as such in the database.

We didn't discuss that.

You are saying that if I checked my database for a email address and find it's not there [1] and then create a record for it [2] that sometime after [1] and before [2] someone else could create a record with the exact same email address -- is that it?

If so, then there would be two records with the same email address -- that would be a problem regardless of if I was asking for the email address or the record's ID. On one hand I would get the record that someone else just created and on the other hand, I would get the record I just created. In either case, it would be a mistake -- I see.

Also, if the field was declared as unique, then my script to create my record would fail.

So the only way to do this properly is to declare the field unique, lock down the database between [1] and [2] and check for errors afterwards -- interesting.

Thanks,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux