Results 1 to 4 of 4
Thread: [PHP] Enum at fault?
-
08-03-2005, 06:54 PM #1Web Hosting Master
- Join Date
- Aug 2000
- Posts
- 2,754
[PHP] Enum at fault?
Can anyone tell me whats wrong with this code?
PHP Code:
CREATE TABLE pm(
ID int( 11 ) NOT NULL AUTO_INCREMENT ,
login char( 16 ) ,
message text,
looked enum( 'N', 'Y' ) NOT NULL default 'N',
PRIMARY KEY ( ID ) ,
UNIQUE ID( ID )
PHP Code: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 '' at line 7
-
08-03-2005, 07:46 PM #2Junior Guru Wannabe
- Join Date
- Jan 2005
- Posts
- 66
You forgot the closing )
-
08-10-2005, 05:22 AM #3Web Hosting Master
- Join Date
- Dec 2004
- Location
- Canada
- Posts
- 1,097
Yup, Specks got it ...unless of course you just missed it when pasting it in.
Also, PRIMARY KEY implies UNIQUE, so the unique key you're defining is unnecessary, and you can safely omit that statement.
-
08-10-2005, 01:38 PM #4Junior Guru Wannabe
- Join Date
- Jan 2005
- Posts
- 66
MySQL won't refuse the SQL though. I tried it out in phpMyAdmin and the worst that happened was that phpMyAdmin flagged the fact that field ID shouldn't have both UNIQUE ID() and PRIMARY ID() flagged at the same time. Bantam, you should take out the UNIQUE ID() though, error404 is right. Its redundant.