inherit
128590
0
Aug 25, 2012 20:46:48 GMT -8
Nick (Goodbye!)
AMF!
1,813
July 2008
nickos
|
Post by Nick (Goodbye!) on Mar 7, 2010 10:46:52 GMT -8
# MySQL dump 4.0 # #-------------------------------------------------------- # # Table structure for table 'forum' # CREATE TABLE forum(
id INT( 11 ) AUTO_INCREMENT '0' NOT NULL AUTO_INCREMENT , name VARCHAR( 30 ) , email VARCHAR( 100 ) , topic VARCHAR( 50 ) , body BLOB, host VARCHAR( 50 ) , thread INT( 11 ) AUTO_INCREMENT '0' NOT NULL , datestamp DATETIME AUTO_INCREMENT '0000-00-00 00:00:00' NOT NULL , KEY datestamp( datestamp ) , PRIMARY KEY ( id ) , KEY thread( thread ) );
MySQL said:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''0' NOT NULL auto_increment, name varchar(30), email varchar(100), topi' at line 9
What does this mean?
|
|
inherit
77753
0
Jul 18, 2024 12:23:50 GMT -8
Bob
2,623
April 2006
bobbyhensley
|
Post by Bob on Mar 7, 2010 11:27:04 GMT -8
# MySQL dump 4.0 # #-------------------------------------------------------- # # Table structure for table 'forum' # CREATE TABLE forum( id INT( 11 ) AUTO_INCREMENT '0' NOT NULL AUTO_INCREMENT , name VARCHAR( 30 ) , email VARCHAR( 100 ) , topic VARCHAR( 50 ) , body BLOB, host VARCHAR( 50 ) , thread INT( 11 ) AUTO_INCREMENT '0' NOT NULL , datestamp DATETIME AUTO_INCREMENT '0000-00-00 00:00:00' NOT NULL , KEY datestamp( datestamp ) , PRIMARY KEY ( id ) , KEY thread( thread ) ); MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''0' NOT NULL auto_increment, name varchar(30), email varchar(100), topi' at line 9 What does this mean? So ignoring the fact that I don't even know what you're trying to accomplish (other than this is a table for a forum) and I can already tell you're doing it wrong. Have you actually read through your own SQL? I don't mean to sound like a jerk, but judging by your web site you're interested in actually learning how to write code. And about 120% of writing code is debugging it. The first step to debugging is carefully reading through what you have. id INT( 11 ) AUTO_INCREMENT '0' NOT NULL AUTO_INCREMENT ,Alright, so right off the bat you should notice that you're trying to make the ID column auto. Twice. Not only can you only have one auto column in a table, but you shouldn't be repeating yourself. Also, what's up with the '0'? If you were trying to assign a default value, then don't- an auto integer is set automatically, no need to define a default. thread INT( 11 ) AUTO_INCREMENT '0' NOT NULL ,So here, as I mentioned above, we can only have one auto column in a table. datestamp DATETIME AUTO_INCREMENT '0000-00-00 00:00:00' NOT NULL ,Again, only one auto allowed. As for the '0000-00-00 00:00:00', I'm assuming you want that to be default? In which case the correct syntax is DEFAULT '0000-00-00 00:00:00'So now that all is said and done, here is what I believe you were trying to accomplish: CREATE TABLE forum ( id INT(11) NOT NULL AUTO_INCREMENT, name VARCHAR (30), email VARCHAR (100), topic VARCHAR (50), body TEXT, host VARCHAR (50), thread INT(11) NOT NULL, datestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', KEY (datestamp), KEY (thread), PRIMARY KEY (id) ) Edit: rewrote how I explained the default on the id column.
|
|
inherit
128590
0
Aug 25, 2012 20:46:48 GMT -8
Nick (Goodbye!)
AMF!
1,813
July 2008
nickos
|
Post by Nick (Goodbye!) on Mar 7, 2010 12:00:53 GMT -8
So ignoring the fact that I don't even know what you're trying to accomplish (other than this is a table for a forum) and I can already tell you're doing it wrong. Have you actually read through your own SQL? I don't mean to sound like a jerk, but judging by your web site you're interested in actually learning how to write code. And about 120% of writing code is debugging it. The first step to debugging is carefully reading through what you have. id INT( 11 ) AUTO_INCREMENT '0' NOT NULL AUTO_INCREMENT ,Alright, so right off the bat you should notice that you're trying to make the ID column auto. Twice. Not only can you only have one auto column in a table, but you shouldn't be repeating yourself. Also, what's up with the '0'? If you were trying to assign a default value, then don't- an auto integer is set automatically, no need to define a default. thread INT( 11 ) AUTO_INCREMENT '0' NOT NULL ,So here, as I mentioned above, we can only have one auto column in a table. This part was an accident because I was removing the DEFAULTS. This is from an older SQL script where DEFAULT's aren't supported anymore. And thanks for the rest of your help.
|
|