Re: Automatic, Hidden Unique ID

From: Date: Thu, 26 Oct 2000 01:30:34 +0000
Subject: Re: Automatic, Hidden Unique ID
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-21993@lists.php.net to get a copy of this message
On Thu, 26 Oct 2000, Austin Carpenter wrote: > Hi, > > I am trying to make a product review database, and I want to have an ID > field in the mysql database. So, how can I get php to generate a number > automatically, hidden from the user, make sure it is right after the > previous number, and make sure it hasn't been used, then save that as a > variable. Thanks in advance. > > Thanks, > Austin Carpenter Let your database do the work. Use an auto-increment field as the unique key, and you can then use mysql_insert_id to get the id generated from the most recent INSERT. -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#21993) next »