The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Databases
> MySQL Help
|
ERROR 1064 (42000): You have an error in your SQL syntax
Discuss ERROR 1064 (42000): You have an error in your SQL syntax in the MySQL Help forum on Dev Shed. ERROR 1064 (42000): You have an error in your SQL syntax MySQL Help forum discussing administration, SQL syntax, and other MySQL-related topics. MySQL is an open-source relational database management system (RDBMS).
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 23rd, 2009, 09:16 AM
|
|
Registered User
|
|
Join Date: Jan 2009
Posts: 3
Time spent in forums: 35 m 26 sec
Reputation Power: 0
|
|
|
ERROR 1064 (42000): You have an error in your SQL syntax
yeah, i have no clue what's going on with this command. it seems simple enough. this is just a table to hold user info for a crappy little game i'm making
here's a screenshot from my shell:
(imagine a pretty screenshot if i wasn't a new user on this forum)
Code:
CREATE TABLE character (
char_id int(7) UNSIGNED NOT NULL AUTO_INCREMENT,
username varchar(20) NOT NULL,
password varchar(16) NOT NULL,
email varchar(40) NOT NULL,
player_name varchar(20) NOT NULL,
title varchar(20),
avatar varchar(120) NOT NULL default 'img.dailymail.co.uk/i/pix/2008/04_02/RickAstleyREX_468x608.jpg',
age int(4) NOT NULL,
gender varchar(6) NOT NULL,
description varchar(255),
date_joined datetime NOT NULL,
date_active datetime NOT NULL,
class int(2) NOT NULL,
PRIMARY KEY (char_id),
KEY player_name (player_name)
);
and i instantly get this error:
ERROR 1064 (42000): 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 'char (
char_id int(7) UNSIGNED NOT NULL AUTO_INCREMENT,
username varchar(' at line 1
Last edited by Guelphdad : January 23rd, 2009 at 09:54 AM.
|

January 23rd, 2009, 09:31 AM
|
|
Contributing User
|
|
Join Date: May 2007
Posts: 40
Time spent in forums: 8 h 12 m 30 sec
Reputation Power: 6
|
|
|
could it be that you have "char id" maybe remove the char or add a _
|

January 23rd, 2009, 09:43 AM
|
|
Registered User
|
|
Join Date: Jan 2009
Posts: 3
Time spent in forums: 35 m 26 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by binindex could it be that you have "char id" maybe remove the char or add a _ |
it's actually char_id and it seems that i get the same error no matter what i name the table. i've got a few of these tables to dump and this was the first one 
funny thing is, i went ahead and tried to add the next table and it worked.
i forgot to add earlier, if it matters, i'm running mac os x 10.5.6 and the latest mysql
|

January 23rd, 2009, 09:57 AM
|
 |
Hockey face
|
|
Join Date: Nov 2001
Location: St. Catharines, Canada
|
|
|
CHARACTER is a reserved word so you can't name your table that.
|

January 23rd, 2009, 11:14 AM
|
|
Registered User
|
|
Join Date: Jan 2009
Posts: 3
Time spent in forums: 35 m 26 sec
Reputation Power: 0
|
|
Query OK, 0 rows affected (0.01 sec)
heh heh, bad character, bad! you're sleeping on the porch tonight!
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|