Page 1 of 1

phpMyAdmin gives syntax error on 'perfect' table script

Posted: Tue May 13, 2003 9:19 pm
by Abby
This script is identical in syntax to other code that was succesfully entered into phpMyAdmin. I am puzzled because it should work. Could someone try it out for me? Cheers Abby

---------
CREATE TABLE ADDRESS
(
addressID INT(10) NOT NULL AUTO_INCREMENT,
addressType VARCHAR(8) NOT NULL,
street1 VARCHAR(50),
street2 VARCHAR(50,
town VARCHAR(50),
state CHAR(5),
postcode VARCHAR(10),
country VARCHAR(20) REFERENCES COUNTRY (country),
email VARCHAR(50),
url VARCHAR(50),
phone CHAR(15),
mobile CHAR(15),
fax CHAR(15),
PRIMARY KEY ('addressID')
);

-------------

Posted: Wed May 14, 2003 2:46 am
by twigletmac
What exactly is the error?

Mac

Error message

Posted: Wed May 14, 2003 9:23 pm
by Abby
This is the error message:

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 ' town VARCHAR( 50 ) , state CHAR( 5 ) , postcode VARCHAR( 10

Posted: Thu May 15, 2003 2:48 am
by twigletmac
Possibly because there's a missing closing parenthesis on this line:

Code: Select all

street2 VARCHAR(50,
Mac

Error message

Posted: Fri May 16, 2003 12:04 am
by Abby
The missing parenthesis was a real booboo but it still returns the same error.

Posted: Fri May 16, 2003 12:09 am
by m3mn0n
Maybe it's the smiley face in the middle of the code.


:wink: hehe~

Posted: Fri May 16, 2003 2:42 am
by twigletmac
Think I've spotted it:

Code: Select all

PRIMARY KEY ('addressID')
should be either:

Code: Select all

PRIMARY KEY (`addressID`)
(using backticks instead of single quotes around the table name) or

Code: Select all

PRIMARY KEY (addressID)

(without any backticks)

Mac