Hi,

On Sun, May 19, 2002 at 05:14:49PM +0200, Gyulay Gabor wrote:
> This is a basic problem.
> I need an unique id in a table, so I choosed integer with
> auto increment. (it is so simple...)
> 
> After inserting a record, I have to display the created
> unique id to identify that record later.
> 
> But how can I select it ? If I select the last record, I
> should get another one, inserted by a concurrent user.
> 

Use SELECT LAST_INSERT_ID() like described in the manual.

LAST_INSERT_ID is kept per database connection, so concurrent users
don't create any problems.


Regards,

Fred.


The stupid filter needs sql,query

-- 
Fred van Engen                              XO Communications B.V.
email: [EMAIL PROTECTED]             Televisieweg 2
tel: +31 36 5462400                         1322 AC  Almere
fax: +31 36 5462424                         The Netherlands

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to