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. Quote Link to comment 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) 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.