www.webdeveloper.com
Results 1 to 4 of 4

Thread: Trouble with MYSQL Syntax

  1. #1
    Join Date
    Dec 2005
    Posts
    123

    Trouble with MYSQL Syntax

    Hi guys, i'm following a tutorial on php/mysql and i'm attempting to input this sql code into a db in phpmyadmin
    Code:
    CREATE TABLE `databasename`.`cmsarticles` (
    `ID` int(6) unsigned NOT NULL auto_increment COMMENT 'The unique ID of the article',
    `title` varchar(200) NULL COMMENT 'The article title',
    `tagline` varchar(255) NULL COMMENT 'Short summary of the article',
    `section` int(4) NULL DEFAULT 0 COMMENT 'The section of the article',
    `thearticle` text NULL COMMENT 'The article itself',
    PRIMARY KEY (`ID`)
    );
    The writer of the tutorial said a simple copy and paste just see the MYSQL db setup, but i have attempted to alter the code and remove some of the " ' " from the code and i keep getting erorr's. The error i get when i attemp to run that code is
    You have an error in your SQL syntax near 'COMMENT 'The unique ID of the article', `title` varchar(200) NULL COMMENT 'The a
    Any help is much appriciated.
    MegaTron

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,321
    Not sure if this is the problem, but how about trying:
    Code:
    ...
    `ID` int(6) unsigned NOT NULL auto_increment PRIMARY KEY COMMENT 'The unique ID of the article',
    ...
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Dec 2005
    Posts
    123
    I have modified the code to this after according to your post
    Code:
    CREATE TABLE cmsarticles(
    ID int( 6 ) unsigned NOT NULL auto_increment PRIMARY KEY ,
    title varchar( 200 ) NULL ,
    tagline varchar( 255 ) NULL ,
    section int( 4 ) NULL DEFAULT 0,
    thearticle text NULL ,
    )
    i'm still getting "You have an error in your SQL syntax near ')' at line 1" as an error message thou

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,321
    The last comma (just before the closing parenthese) needs to be deleted.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles