I have a site where things in the database have ids.  When something new is
added, it gets an id one higher than the highest existing id.  I use code
something like this:

$gethighestid = mysql_fetch_array(mysql_query("select id from table order by
id desc limit 1"));
$tobeid = $gethighestid[id]+1;
mysql_query("insert into table(id,othercolumn,othercolumn2)

The thing is, I just got two rows with duplicate ids.  Aparantley, two
people must of added two things at just the right times to make the same id.
Is there any way that will reduce, or eliminate, the time gap between
getting id and inserting? 

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

Reply via email to