Reply to reading auto increment number before it is written?

Your name:

Reply:


Posted by x0054 on 07/14/06 18:56

Ok, this is a stupid problem, I admit. I have a scrip that adds records to
a table. The records are for photos. So, after adding a record the scrip
also uploads a picture from users computer and renames it to
{$recordID}.jpg.

The problem is, my recordID field is auto incrementing in mySQL. So
currently I just take the last added record and assume that it the one I
just added, and rename the file to the recordID of that record. It works,
but clearly isn't the best way to do this as 2 users can add records at the
same time and then I would have a problem.

So what I am wondering is if there is a way to write a record to mySQL and
then have mySQL return recordID of the record just written?

- Bogdan

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация