Re: mysql ID's
| From: | Russ Michell | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: mysql ID's | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-13327@lists.php.net to get a copy of this message | ||
You need to set the id field as 'auto_increment':
ALTER TABLE <table_name> CHANGE id id SMALLINT (5) DEFAULT '0' not null
AUTO_INCREMENT;
I think that's it.
If you use phpMyAdmin, you can do it by there easily.
Cheers.
Russ
On Mon, 15 Oct 2001 23:26:45 +1000 Adam Jackson <adam@weblinx.com.au> wrote:
>
> i dont know if this should be posted here or a mysql list but its worth a
> try..
>
> I am trying to make it so that when i create a row with user details one of
> the columns is automatically generated with the next id. for example p00001,
> p00002 etc etc. I am fairly new to PHP, MySQL so bare with me :)
>
> any assistance is greatly appreciated.
>
> -Adam
#-------------------------------------------------------#
"Believe nothing - consider everything"
Russ Michell
Anglia Polytechnic University Webteam
Room 1C 'The Eastings' East Road, Cambridge
e: r.j.michell@apu.ac.uk
w: www.apu.ac.uk/webteam
www.theruss.com
#-------------------------------------------------------#