Results 1 to 4 of 4
  1. #1
    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 int11 NOT NULL AUTO_INCREMENT ,
    login char16 ) ,
    message text,
    looked enum'N''Y' NOT NULL default 'N',
    PRIMARY KEY ID ) ,
    UNIQUE IDID 
    my error is:

    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 
    But I cannot see whats wrong with it, all the other create table commands work throughout my script but this one out of 5 fails.

  2. #2
    You forgot the closing )

  3. #3
    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.

  4. #4
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •