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); Link to comment https://forums.phpfreaks.com/topic/79286-automatically-increment-id/ 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, )"; Link to comment https://forums.phpfreaks.com/topic/79286-automatically-increment-id/#findComment-401331 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.