Re: [PHP-DB] mysql ID's From: Russ Michell (r.j.michell <email protected>)
Date: 10/15/01

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 <email protected>> 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 <email protected>
  w: www.apu.ac.uk/webteam

  www.theruss.com
                        
#-------------------------------------------------------#

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>