"Binay" <[EMAIL PROTECTED]> wrote:
> Hi 
>
> I have a php script which insert a row in one of my table. Now i want the 
> auto_generated id produced by this insert query. I know i can use mysql_insert_id 
> function to fetch that auto_generated id. But my question is say two or more person 
> visiting the same page/script causes a insert operation in the table at the same 
> time. so there are chances of getting wrong auto_generated ids for different 
> visitors. why am i saying this can be clear from below example.
>
> Say one insert operation is in the progress and by the time control switches/call to 
> mysql_insert_id function another insert operation starts .. so ultimately 
> mysql_insert_id will fetch 2nd insert operation id which should not be the case. How 
> to resolve this case??

LAST_INSERT_ID() is a connection specific function. It returns last generated value 
for auto_increment column for the current connection. Some other info about this 
function you can find in the MySQL manual:
        http://www.mysql.com/doc/en/Information_functions.html





-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to