Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase 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 Codewalkers Forums Sponsor:
  #1  
Old May 21st, 2003, 07:25 AM
skintstudent skintstudent is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 3 skintstudent User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
mySQL NewB - CREATE TABLE error

I'm just starting out with mysql and have been trying to use phpAdmin to create a table.
However I get the error message:
You have an error in your SQL syntax near 'NOT NULL, `password` VARCHAR NOT NULL, `usertype` INT NOT NULL, `startpage` VARC' at line 1

The SQL statement it produces is:

CREATE TABLE `user_user` (

`userid` INT NOT NULL ,
`username` VARCHAR NOT NULL ,
`password` VARCHAR NOT NULL ,
`usertype` INT NOT NULL ,
`startpage` VARCHAR NOT NULL ,
PRIMARY KEY ( `userid` ) ,
UNIQUE (
`username`
)
)

I've tried removing the signle-quotes but that hasn't helped.

Any ideas?

Reply With Quote
  #2  
Old May 21st, 2003, 02:04 PM
sketch sketch is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 sketch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: mySQL NewB - CREATE TABLE error

not a db master, but yeah, i wouldnt put the single quote in and i would not have any space between the the last word and the comma (in this example, no space beween NULL and the comma)

CREATE TABLE tablename (column1 INTEGER NOT NULL, column2 INTEGER NOT NULL

Reply With Quote
  #3  
Old May 21st, 2003, 05:17 PM
brut brut is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 367 brut User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 30 sec
Reputation Power: 2
RE: mySQL NewB - CREATE TABLE error

Your commas shouldn't be a problem, but you should remove the single quotes, and specify a size for each field. Single quotes will be used in SELECTs or INSERTs etc for textual data.
Code:
CREATE TABLE user_user (
userid INT(10) NOT NULL ,
username VARCHAR(50) NOT NULL ,
password VARCHAR(50) NOT NULL ,
usertype INT(10) NOT NULL ,
startpage VARCHAR(50) NOT NULL ,
PRIMARY KEY ( userid ) ,
UNIQUE (username)
);

Reply With Quote
  #4  
Old May 22nd, 2003, 04:29 AM
skintstudent skintstudent is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 3 skintstudent User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: mySQL NewB - CREATE TABLE error

Thanks Brut, got it working!

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > mySQL NewB - CREATE TABLE error


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 4 hosted by Hostway
Stay green...Green IT