|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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) ); |
|
#4
|
|||
|
|||
|
RE: mySQL NewB - CREATE TABLE error
Thanks Brut, got it working!
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > mySQL NewB - CREATE TABLE error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|