Dysan Posted November 28, 2007 Share Posted November 28, 2007 I have the following code that creates a table. Can the ID field be made as an auto-incrementing field? mysql_select_db("DB", $con); $sql = "CREATE TABLE Data ( ID int, Firstname text, Lastname text, Age int, )"; mysql_query($sql,$con); Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 28, 2007 Share Posted November 28, 2007 I believe you would just add AUTO_INCREMENT to the line. $sql = "CREATE TABLE Data ( ID int AUTO_INCREMENT, Firstname text, Lastname text, Age int, )"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.