For some reason this query is wrong?
CREATE TABLE tutorial (
id int(10) NOT NULL auto_increment,
author text,
category text,
tutorial text,
title text,
ip text,
val text,
desc text,
PRIMARY KEY (id)
) TYPE = MYISAM ;
CREATE TABLE tut_comments (
id int(10) NOT NULL auto_increment,
posterNAME text,
postEMAIL text,
postTIME text,
postMSG text,
tutID text,
PRIMARY KEY (id)
) TYPE = MYISAM ;
Anybody know what i'm doing wrong, something about "desc text" ...
MYSQL QUERY PROBLEMS
Started by Lyall, Mar 23 2007 04:57 PM
2 replies to this topic
#1
Posted 23 March 2007 - 04:57 PM
#2
Posted 23 March 2007 - 05:17 PM
Try this.
You most probably ran into a MySQL keyword. You should always use the appropriate characters to indicate database/table/column names to avoid this.
CREATE TABLE `tutorial` ( `id` int(10) NOT NULL auto_increment, `author` text, `category` text, `tutorial` text, `title` text, `ip` text, `val` text, `desc` text, PRIMARY KEY (`id`) ) TYPE = MYISAM ; CREATE TABLE `tut_comments` ( `id` int(10) NOT NULL auto_increment, `posterNAME` text, `postEMAIL` text, `postTIME` text, `postMSG` text, `tutID` text, PRIMARY KEY (`id`) ) TYPE = MYISAM ;
You most probably ran into a MySQL keyword. You should always use the appropriate characters to indicate database/table/column names to avoid this.
#3
Posted 23 March 2007 - 10:45 PM
I'd recommend a structure similar to:
Correct. 'desc' or 'DESC' - is a MySQL keyword.
CREATE TABLE `tutorial` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `author` VARCHAR(255), `category` VARCHAR(255), `tutorial` TEXT, `title` VARCHAR(255), `ip` VARCHAR(20), `val` VARCHAR(255), `desc` VARCHAR(255), PRIMARY KEY (`id`) ); CREATE TABLE `tut_comments` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `posterNAME` VARCHAR(255), `postEMAIL` VARCHAR(255), `postTIME` INT(11), #I'd suggest using some sort of timestamp - time() for example. `postMSG` TEXT, `tutID` INT UNSIGNED NOT NULL, #I'm just assuming this is the id from the tutorial table? PRIMARY KEY (`id`), KEY `tutID` (`tutID`) );
Demonslay, on Mar 23 2007, 06:17 PM, said:
You most probably ran into a MySQL keyword. You should always use the appropriate characters to indicate database/table/column names to avoid this.
Edited by SecondV, 23 March 2007 - 10:44 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
