Re: [PHP] MySQL Insert with Auto-Increment

2003-04-04 Thread Marek Kilimajer
use mysql_insert_id(), it keeps its value per connection so you don't 
need to worry about anything

[EMAIL PROTECTED] wrote:

Ok, here's what I have.  I want to insert some values into a table with 
an auto_increment field, but I want to get the Serial of the record I 
just inserted so I can name an image $Serial.jpg.  I could just select 
the serial of the last record entered but what happens (and I know it's 
unlikely but could happen) if someone else inserted another record a 
half a second after this one?  Anyone have any ideas?  Thanks!

Brian

 



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


RE: [PHP] MySQL Insert with Auto-Increment

2003-04-04 Thread Sysadmin
Wonderful!  Thanks!

-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: Friday, April 04, 2003 8:18 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] MySQL Insert with Auto-Increment


use mysql_insert_id(), it keeps its value per connection so you don't 
need to worry about anything

[EMAIL PROTECTED] wrote:

Ok, here's what I have.  I want to insert some values into a table 
with 
an auto_increment field, but I want to get the Serial of the record I 
just inserted so I can name an image $Serial.jpg.  I could just select 
the serial of the last record entered but what happens (and I know 
it's 
unlikely but could happen) if someone else inserted another record a 
half a second after this one?  Anyone have any ideas?  Thanks!

Brian


  



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