MySQL Syntax Error

Discussion in 'PHP' started by blueparukia, Nov 23, 2007.

  1. #1
    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 9

    I could probably find the error myself tomorrow, as its very late here, but I don't want to go through all the bother,
    Seems like I'm just missing/have an extra character

    BP.

    mysql_connect($host,$dbuser,$dbpass);
    mysql_select_db($dbname) or die(mysql_error());
    mysql_query("CREATE TABLE `results` (
    `url` VARCHAR( 30 ) NOT NULL ,
    `submittedby` VARCHAR( 30 ) NOT NULL ,
    `date` DATE NOT NULL ,
    `categoryone` VARCHAR( 30 ) NOT NULL ,
    `category2` VARCHAR( 30 ) NOT NULL ,
    `pr` INT NOT NULL,
    `title` TEXT NOT NULL,
    )")
    or die(mysql_error());
    }
    PHP:
     
    blueparukia, Nov 23, 2007 IP
  2. greatlogix

    greatlogix Active Member

    Messages:
    664
    Likes Received:
    13
    Best Answers:
    1
    Trophy Points:
    85
    #2
    Remove , from end of the line
     
    greatlogix, Nov 23, 2007 IP
    blueparukia likes this.
  3. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #3
    Thanks :D

    Rep added, though I solved this by just getting phpMyAdmin to generate the code...

    Cheers,
    BP
     
    blueparukia, Nov 23, 2007 IP