Aleks Kalynovych wrote:
> I have a couple forms that generate a unique ID based on taking
> the highest
> number in the ID column adding 1 to its value. The problem is that I
> donât save that number until the form is submitted. If 2 or more
> persons fill out
> the form at the same time they all get the same
> ID number.  I hope that there are some suggestions on how to
> accomplish this
> with a better method

You really should avoid using this method precisely because of the concurrency issue 
that will invariably happen. If you're using MySQL and your ID field is of type 
AUTO_INCREMENT then you can use MySQL built-in method named: LAST_INSERT_ID() or in 
PHP you can use a function named: mysql_insert_id()


For more information visit:

This is concurrency safe so you shouldn't have this problem in the future.


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

Reply via email to