...

View Full Version : sql syntax error



thesavior
07-23-2006, 07:16 PM
My query:


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)

GJay
07-23-2006, 07:17 PM
'desc' is a reserved word.

vinyl-junkie
07-23-2006, 08:05 PM
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:


$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";

thesavior
07-23-2006, 08:15 PM
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

Brandoe85
07-23-2006, 08:58 PM
You can also place the desc in backticks `desc` and it should work.

Good luck;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum