Jump to content

SQL ID auto_increment


morrisjohnny
 Share

Recommended Posts

I'm having problems setting up the ID to auto_incrementI can do everything else apart from when i go to add another user to the database i can't make the ID increase by it's self.I would like a few rows if possibleID PRIMARY KEY (auto_increment?)login VARCHAR(999);pazzword VARCHAR(999);mail VARCHAR(999);dosh NUMBER;I'd be very grea tful if someone could type out the code so i could learn. and use it.I am new to databases so I'm sorry if this isn't clear. thanks-Johnny(a bit off topic using php how would i insert the ID? like in PHP it would be $_POST['name'] for their name what about ID auto_increment?)

Link to comment
Share on other sites

The easiest way to do it is to use phpMyAdmin, which will show you the SQL code that it uses to do everything. So you can create a new table with a column set to be auto_increment, and you will see the create table statement that it used to create it.You can also check the MySQL documentation:http://mysql.org/doc/refman/5.0/en/example...-increment.html

Link to comment
Share on other sites

The easiest way to do it is to use phpMyAdmin, which will show you the SQL code that it uses to do everything. So you can create a new table with a column set to be auto_increment, and you will see the create table statement that it used to create it.You can also check the MySQL documentation:http://mysql.org/doc/refman/5.0/en/example...-increment.html
Cheers i did notice the sql code that shows up :) Pretty handy i do have to say.
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY

Should work

Yip works like a charm cheers :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...