ShoeLace1291 Posted June 18, 2007 Share Posted June 18, 2007 Ok, I'm trying to make an installer but it says the sql syntax for my table creations code is wrong. I think it has to do with the Auto Increment function. This is my code: $articles = "CREATE TABLE tech_articles (" . " articleID INTEGER(15) NOT NULL" . ", authorID INTEGER(15) NOT NULL" . ", headline VARCHAR(50) NOT NULL" . ", articleContent TEXT NOT NULL" . ", datetimePosted DATETIME NOT NULL" . ")"; $admins = "CREATE TABLE tech_administrators (" . " userID INTEGER(15) NOT NULL AUTO INCREMENT" . ", loginName VARCHAR(20) NOT NULL" . ", loginPass VARCHAR(80) NOT NULL" . ", userEmail VARCHAR(100) NOT NULL" . ")"; $comments = "CREATE TABLE tech_comments (" . " commentID INTEGER(15) NOT NULL AUTO INCREMENT" . ", authorID INTEGER(15) NOT NULL" . ", articleID INTEGER(15)" . ", commentText TEXT NOT NULL" . ", datetimePosted DATETIME NOT NULL" . ")"; if (mysql_query($articles)) { print("Articles table created.\n"); } else { print(mysql_error()); } if(mysql_query($admins)){ print("Administrators table created.\n"); } else { print(mysql_error()); } if(mysql_query($comments)){ print("Comments table created.\n"); } else { print(mysql_error()); } In the tech administrators table, I want userID to be auto increment. Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/56103-auto-inc-in-php-table-creation/ Share on other sites More sharing options...
Corona4456 Posted June 18, 2007 Share Posted June 18, 2007 AUTO INCREMENT is supposed to be AUTO_INCREMENT (no space) Link to comment https://forums.phpfreaks.com/topic/56103-auto-inc-in-php-table-creation/#findComment-277081 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.