General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 25th, 2003, 11:47 AM
EvilXParser EvilXParser is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 9 EvilXParser User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Error Creating Table, Someone Help please

I received the following error:

You have an error in your SQL syntax near ''test' ('name' VARCHAR( 32 ) NOT NULL ,'comment' VARCHAR( 255 ) NOT NULL ,'email' at line 1

using the follwing code:

$query2="CREATE TABLE $username ('name' VARCHAR( 32 ) NOT NULL ,'comment' VARCHAR( 255 ) NOT NULL ,'email' VARCHAR( 50 ) NOT NULL ,'site' VARCHAR( 64 ) NOT NULL ,'ip' VARCHAR( 50 ) NOT NULL ,'id' INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY)";

mysql_query($query2);

$username is a variable that has ' added in the beginning and ' added at the end. In between the ' ' is the username the user submitted from a form. I have tried to fix the problem myself and cant, can someone help? I would really appreciate it!

Last edited by EvilXParser : August 25th, 2003 at 11:52 AM.

Reply With Quote
  #2  
Old August 25th, 2003, 12:27 PM
wastedbreath wastedbreath is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: BC, Canada
Posts: 35 wastedbreath User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to wastedbreath
Umm not to sure about this, but I don't think you're supposed to have the variable in there when you create a table..

Reply With Quote
  #3  
Old August 25th, 2003, 12:36 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
The variable has nothing to do with it.

The problem is that you have quotes around your column names instead of the backtick.

' versus `

The backtick is on the key just to the left of the #1 on your keyboard.

You actually don't have to have this surrounding your column names... it is nice to qualify the names like that, but it would work equally well if you ommited the quotes around the column names altogether.
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #4  
Old August 25th, 2003, 12:54 PM
EvilXParser EvilXParser is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 9 EvilXParser User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanx alot, I followed ur advice and changed it to:

$query2="CREATE TABLE `$user` (`name` VARCHAR( 32 ) NOT NULL ,`comment` VARCHAR( 255 ) NOT NULL ,`email` VARCHAR( 50 ) NOT NULL ,`site` VARCHAR( 64 ) NOT NULL ,`ip` VARCHAR( 50 ) NOT NULL ,`id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY)";

before $username had a ' added in front and back, now i used $user which was just the username without anything added.

Reply With Quote
  #5  
Old August 25th, 2003, 01:06 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
cool... glad it all worked out.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Error Creating Table, Someone Help please


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway