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')
);
-------------
phpMyAdmin gives syntax error on 'perfect' table script
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Error message
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
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
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Possibly because there's a missing closing parenthesis on this line:
Mac
Code: Select all
street2 VARCHAR(50,Error message
The missing parenthesis was a real booboo but it still returns the same error.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Think I've spotted it:
should be either:
(using backticks instead of single quotes around the table name) or
(without any backticks)
Mac
Code: Select all
PRIMARY KEY ('addressID')Code: Select all
PRIMARY KEY (`addressID`)Code: Select all
PRIMARY KEY (addressID)(without any backticks)
Mac