PDA

View Full Version : Query Problem


adriandaz
08-24-2002, 08:59 AM
Please can someone tell me whats wrong with this:

CREATE TABLE tmplt_users (
index bigint(20) NOT NULL auto_increment,
email text NOT NULL,
name text NOT NULL,
PRIMARY KEY (index)
) TYPE=MyISAM;

I get this error:

MySQL said:

You have an error in your SQL syntax near 'bigint(20) NOT NULL auto_increment,

email text NOT NULL,

name text NOT NUL' at line 2

:bored:

tHE DSS
08-24-2002, 09:15 AM
KEYWORDS/RESERVED WORDS

http://www.mysql.com/doc/en/Reserved_words.html

Basically, your field name "index" is not allowed, as it's reserved.

Check that page, it has a list of words you cannot use as field names.

Change index to somthing like 'tmplt_usersID', or similar, and it'll work.

g-force2k2
08-24-2002, 09:18 AM
yep index is a reserved word you could probably just change it to indexid then ;) but dont' forget to change the primary key afterwards regards :)

g-force2k2