problem with phpmyadmin

I am having problems creating a table within a database already setup with phpmyadmin. I was hoping if someone could please point out what is giong wrong.

[code]
CREATE TABLE `CharsInfo` (

`CharID` INT( 10 ) DEFAULT '0' NOT NULL AUTO_INCREMENT ,
`CharName` VARCHAR( 50 ) NOT NULL ,
`PlayerName` VARCHAR( 50 ) NOT NULL ,
`Password` VARCHAR( 15 ) NOT NULL ,
`Email` VARCHAR( 30 ) NOT NULL ,
`URL` VARCHAR( 30 ) NOT NULL ,
`Age` INT( 4 ) NOT NULL ,
`Sex` VARCHAR( 7 ) NOT NULL ,
`Nature` VARCHAR( 20 ) NOT NULL ,
`Demeanor` VARCHAR( 20 ) NOT NULL ,
`Venue` VARCHAR( 20 ) NOT NULL ,
`Type` VARCHAR( 20 ) NOT NULL ,
`Concept` VARCHAR( 30 ) NOT NULL ,
`Description` VARCHAR( 150 ) NOT NULL ,
`ExitMessage` VARCHAR( 100 ) NOT NULL ,
`Icon` VARCHAR NOT NULL ,
PRIMARY KEY ( `CharID` )
)
[/code]

when I try to save I keep getting this error, could anyone help?
Error =
You have an error in your SQL syntax near 'NOT NULL, PRIMARY KEY (`CharID`))' at line 1

thank you very much
the darthmoob

Comments

  • : I am having problems creating a table within a database already setup with phpmyadmin. I was hoping if someone could please point out what is giong wrong.
    :
    : [code]
    : CREATE TABLE `CharsInfo` (
    :
    : `CharID` INT( 10 ) DEFAULT '0' NOT NULL AUTO_INCREMENT ,
    : `CharName` VARCHAR( 50 ) NOT NULL ,
    : `PlayerName` VARCHAR( 50 ) NOT NULL ,
    : `Password` VARCHAR( 15 ) NOT NULL ,
    : `Email` VARCHAR( 30 ) NOT NULL ,
    : `URL` VARCHAR( 30 ) NOT NULL ,
    : `Age` INT( 4 ) NOT NULL ,
    : `Sex` VARCHAR( 7 ) NOT NULL ,
    : `Nature` VARCHAR( 20 ) NOT NULL ,
    : `Demeanor` VARCHAR( 20 ) NOT NULL ,
    : `Venue` VARCHAR( 20 ) NOT NULL ,
    : `Type` VARCHAR( 20 ) NOT NULL ,
    : `Concept` VARCHAR( 30 ) NOT NULL ,
    : `Description` VARCHAR( 150 ) NOT NULL ,
    : `ExitMessage` VARCHAR( 100 ) NOT NULL ,
    : `Icon` VARCHAR NOT NULL ,
    : PRIMARY KEY ( `CharID` )
    : )
    : [/code]
    :
    : when I try to save I keep getting this error, could anyone help?
    : Error =
    : You have an error in your SQL syntax near 'NOT NULL, PRIMARY KEY (`CharID`))' at line 1
    :
    : thank you very much
    : the darthmoob
    :
    :

    Hi DarthMoob,

    I think it's just a simple database rules error. Notice that you have chosen 'charID' to be your primary key, then it shouldn't set a default value for this column. Coz a primary key must be unique.
  • : : I am having problems creating a table within a database already setup with phpmyadmin. I was hoping if someone could please point out what is giong wrong.
    : :
    : : [code]
    : : CREATE TABLE `CharsInfo` (
    : :
    : : `CharID` INT( 10 ) DEFAULT '0' NOT NULL AUTO_INCREMENT ,
    : : `CharName` VARCHAR( 50 ) NOT NULL ,
    : : `PlayerName` VARCHAR( 50 ) NOT NULL ,
    : : `Password` VARCHAR( 15 ) NOT NULL ,
    : : `Email` VARCHAR( 30 ) NOT NULL ,
    : : `URL` VARCHAR( 30 ) NOT NULL ,
    : : `Age` INT( 4 ) NOT NULL ,
    : : `Sex` VARCHAR( 7 ) NOT NULL ,
    : : `Nature` VARCHAR( 20 ) NOT NULL ,
    : : `Demeanor` VARCHAR( 20 ) NOT NULL ,
    : : `Venue` VARCHAR( 20 ) NOT NULL ,
    : : `Type` VARCHAR( 20 ) NOT NULL ,
    : : `Concept` VARCHAR( 30 ) NOT NULL ,
    : : `Description` VARCHAR( 150 ) NOT NULL ,
    : : `ExitMessage` VARCHAR( 100 ) NOT NULL ,
    : : `Icon` VARCHAR NOT NULL ,
    : : PRIMARY KEY ( `CharID` )
    : : )
    : : [/code]
    : :
    : : when I try to save I keep getting this error, could anyone help?
    : : Error =
    : : You have an error in your SQL syntax near 'NOT NULL, PRIMARY KEY (`CharID`))' at line 1
    : :
    : : thank you very much
    : : the darthmoob
    : :
    : :
    :
    : Hi DarthMoob,
    :
    : I think it's just a simple database rules error. Notice that you have chosen 'charID' to be your primary key, then it shouldn't set a default value for this column. Coz a primary key must be unique.
    :

    Yep .. if it is an auto increment value it defaults to 1 anyway so why are you setting it to '0'?

    That should solve your problem. Get rid of the default clause

    [b][blue]Snoochie Boochies[/blue][/b]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories