#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2009
    Posts
    3
    Rep Power
    0

    ERROR 1064 (42000): You have an error in your SQL syntax


    yeah, i have no clue what's going on with this command. it seems simple enough. this is just a table to hold user info for a crappy little game i'm making
    here's a screenshot from my shell:
    (imagine a pretty screenshot if i wasn't a new user on this forum)

    Code:
    CREATE TABLE character (
     char_id int(7) UNSIGNED NOT NULL AUTO_INCREMENT,
     username varchar(20) NOT NULL,
     password varchar(16) NOT NULL,
     email varchar(40) NOT NULL,
     player_name varchar(20) NOT NULL,
     title varchar(20),
     avatar varchar(120) NOT NULL default 'img.dailymail.co.uk/i/pix/2008/04_02/RickAstleyREX_468x608.jpg',
     age int(4) NOT NULL,
     gender varchar(6) NOT NULL,
     description varchar(255),
     date_joined datetime NOT NULL,
     date_active datetime NOT NULL,
     class int(2) NOT NULL,
     PRIMARY KEY (char_id),
     KEY player_name (player_name)
    );

    and i instantly get this error:
    ERROR 1064 (42000): 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 'char (
    char_id int(7) UNSIGNED NOT NULL AUTO_INCREMENT,
    username varchar(' at line 1
    Last edited by Guelphdad; January 23rd, 2009 at 09:54 AM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2007
    Posts
    40
    Rep Power
    8
    could it be that you have "char id" maybe remove the char or add a _
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2009
    Posts
    3
    Rep Power
    0
    Originally Posted by binindex
    could it be that you have "char id" maybe remove the char or add a _
    it's actually char_id and it seems that i get the same error no matter what i name the table. i've got a few of these tables to dump and this was the first one
    funny thing is, i went ahead and tried to add the next table and it worked.

    i forgot to add earlier, if it matters, i'm running mac os x 10.5.6 and the latest mysql
  6. #4
  7. Hockey face
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    St. Catharines, Canada
    Posts
    8,147
    Rep Power
    1316
    CHARACTER is a reserved word so you can't name your table that.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2009
    Posts
    3
    Rep Power
    0

    Thumbs up


    Query OK, 0 rows affected (0.01 sec)

    heh heh, bad character, bad! you're sleeping on the porch tonight!

IMN logo majestic logo threadwatch logo seochat tools logo