MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 23rd, 2009, 09:16 AM
facethemetal facethemetal is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 3 facethemetal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #2  
Old January 23rd, 2009, 09:31 AM
binindex binindex is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 40 binindex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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 _

Reply With Quote
  #3  
Old January 23rd, 2009, 09:43 AM
facethemetal facethemetal is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 3 facethemetal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #4  
Old January 23rd, 2009, 09:57 AM
Guelphdad's Avatar
Guelphdad Guelphdad is offline
Hockey face
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Nov 2001
Location: St. Catharines, Canada
Posts: 8,141 Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level)Guelphdad User rank is General 5th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 3 Days 20 h 34 m 13 sec
Reputation Power: 1315
CHARACTER is a reserved word so you can't name your table that.

Reply With Quote
  #5  
Old January 23rd, 2009, 11:14 AM
facethemetal facethemetal is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 3 facethemetal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 26 sec
Reputation Power: 0
Thumbs up

Query OK, 0 rows affected (0.01 sec)

heh heh, bad character, bad! you're sleeping on the porch tonight!

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > ERROR 1064 (42000): You have an error in your SQL syntax

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap