1064 - You have an error in your SQL syntax

Discussion in 'MySQL' started by Nintendo, Dec 22, 2009.

  1. #1
    This is a 344 meg database and the error happens at just four small tables out of 233 tables.

    #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
    'desc text NOT NULL,
      ability text NOT NULL,
      hp int(15) NOT
    PHP:
    Here's the code

    CREATE TABLE inferno_heal (
      hid int(11) NOT NULL auto_increment,
      name text NOT NULL,
      img text NOT NULL,
      desc text NOT NULL,
      ability text NOT NULL,
      hp int(15) NOT NULL default '0',
      mp int(15) NOT NULL default '0',
      cost int(15) NOT NULL default '0',
      PRIMARY KEY  (hid)
    ) TYPE=MyISAM;
    
    INSERT INTO inferno_heal VALUES (1,'Small Potion','Potion1.gif','Small Healing Power','Cures Blind',40,10,30);
    PHP:
    If I change

    desc text NOT NULL,

    to

    descrip text NOT NULL,

    then it goes through. How do I make it so it works with 'desc'???
     
    Last edited: Dec 22, 2009
    Nintendo, Dec 22, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    DESC is a reserved word.

    Use backticks `desc` or change the column name to something else.
     
    jestep, Dec 23, 2009 IP