Date: 10/15/01
- Next message: its me: "[PHP-DB] shooping carts"
- Previous message: DL Neil: "Re: [PHP-DB] UPDATE table problem"
- In reply to: Adam Jackson: "[PHP-DB] mysql ID's"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> 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 :)
As I understand your question, the answer is "AUTO_INCREMENT".
I extracted this from <http://www.mysql.com/doc/C/R/CREATE_TABLE.html>
--- > An integer column may have the additional attribute AUTO_INCREMENT. When you > insert a value of NULL (recommended) or 0 into an AUTO_INCREMENT column, the > column is set to value+1, where value is the largest value for the column > currently in the table. AUTO_INCREMENT sequences begin with 1. See section > 8.4.3.126 mysql_insert_id(). If you delete the row containing the maximum > value for an AUTO_INCREMENT column, the value will be reused with an ISAM, or > BDB table but not with a MyISAM or InnoDB table. If you delete all rows in the > table with DELETE FROM table_name (without a WHERE) in AUTOCOMMIT mode, the > sequence starts over for all table types. NOTE: There can be only one > AUTO_INCREMENT column per table, and it must be indexed. ---Regards, Tomás
+-- --+ Tomás García Ferrari Bigital http://bigital.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>
- Next message: its me: "[PHP-DB] shooping carts"
- Previous message: DL Neil: "Re: [PHP-DB] UPDATE table problem"
- In reply to: Adam Jackson: "[PHP-DB] mysql ID's"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

