Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder
    Join Date
    Aug 2005
    Posts
    1,119
    Thanks
    2
    Thanked 1 Time in 1 Post

    sql syntax error

    My query:

    Code:
    CREATE TABLE '.$db_prefix."tutorials (
    			id INT(30) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    			name VARCHAR(80) NOT NULL,
    			desc VARCHAR(100) NOT NULL,
    			poster VARCHAR(20) NOT NULL,
    			clicks INT(30) NOT NULL,
    			category VARCHAR(60) NOT NULL
    		) TYPE=MyISAM;
    Is giving me an error of:

    You have an error in your SQL syntax near 'desc VARCHAR(100) NOT NULL, poster VARCHAR(20) NOT NULL, clicks INT(30) ' at line 4 (Errno: 1064)

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    'desc' is a reserved word.

  • #3
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,083
    Thanks
    2
    Thanked 23 Times in 23 Posts
    Taking into consideration GJay's post, I believe you still have some syntax problems with this. I've turned it into the PHP statement that I'm guessing you want it to be:

    Code:
    $sql = "CREATE TABLE ".$db_prefix."tutorials (
    			id INT(30) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    			name VARCHAR(80) NOT NULL,
    			descript VARCHAR(100) NOT NULL,
    			poster VARCHAR(20) NOT NULL,
    			clicks INT(30) NOT NULL,
    			category VARCHAR(60) NOT NULL
    		) TYPE=MyISAM";
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #4
    Senior Coder
    Join Date
    Aug 2005
    Posts
    1,119
    Thanks
    2
    Thanked 1 Time in 1 Post
    no, i had no syntax error, and it was used in a function, so i didn't need to show you everything, just the query. But thanks for checking vinyl-junkie

  • #5
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    You can also place the desc in backticks `desc` and it should work.

    Good luck;


  •  

    Posting Permissions

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