Re: MySQL Insert with Auto-Increment
| From: | Marek Kilimajer | Date: | Fri, 04 Apr 2003 13:17:38 +0000 |
| Subject: | Re: MySQL Insert with Auto-Increment | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142319@lists.php.net to get a copy of this message | ||
use mysql_insert_id(), it keeps its value per connection so you don't need to worry about anything
Sysadmin@saginawcontrol.com 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