|
Posted by J.O. Aho on 09/28/56 11:46
Rik wrote:
> number1.email@gmail.com wrote:
>> Problem is, what if someone also
>> requests this same userid before I "insert" my record?
>
> Why would thid happen? It seems to me this is not a database problem but a
> code problem.
It would happen if he writes his scripts to fetch the highest ID-value from
the table and in php does a $ID++ and then makes the INSERT and then two
persons would register themselves at the "same time", only one would be
registered and the other would get an error message as that one was trying to
create a user with the same ID-number.
Of course this is a code problem and the mysql AUTO_INCREMENT will fix if the
INSERT is made without trying to set an ID, "INSERT INTO
users(Name,Login,Password) VALUES('Joe Doe','Joe','Doe')" in a table with the
columns ID,Name,Login,Password, where Id had the AUTO_INCREMENT set.
//Aho
Navigation:
[Reply to this message]
|