Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

MySQL error

Options
  • 18-11-2005 5:39pm
    #1
    Registered Users Posts: 673 ✭✭✭


    Hey,

    Im new to MySQL so this is probably a no brainer!! Im using phpmyadmin to set up a new table in my database. Im getting this error message when i try to save it though:

    #1064 - 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 '(20) NOT NULL, `registration` TIME(20), `game_start` TIME(20) D


    This makes no sense to me at all. I am trying to input a field for the registration time so i have put in the following details:

    registration time(20) NOT NULL,

    I have even tried putting it in as a char and a varchar but am getting the same error which is really confusing me. Anyone know what im doing wrong?

    Thnaks


Comments

  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    The TIME datatype doesn't take any arguments.

    Try just

    "registration TIME NOT NULL"


  • Registered Users Posts: 673 ✭✭✭Bananna man


    seamus wrote:
    The TIME datatype doesn't take any arguments.

    Try just

    "registration TIME NOT NULL"

    Thanks for the reply!!

    I've tried that but am still getting the same error. I thought it might have been something like that and thats why i tried it with the CHAR and VARCHAR but that gives me the same error. Thats what's really puzzling me. I have now set the table type to "default", is this ok?


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Post up the full query there...


  • Registered Users Posts: 673 ✭✭✭Bananna man


    This is the code in full which i have also tried to upload into the database manually without phpmyadmin but got the same error.

    CREATE TABLE `tournaments` (
    `venue` VARCHAR( 150 ) NOT NULL ,
    `address` VARCHAR( 255 ) NOT NULL ,
    `date` DATE( 20 ) NOT NULL ,
    `registration` TIME NOT NULL ,
    `game_start` TIME NOT NULL ,
    `finish_time` TIME NOT NULL ,
    `prize` INT( 20 ) ,
    `buy_in` INT( 20 ) ,
    `re_buys` INT( 20 ) ,
    `additional_info` VARCHAR( 255 ) ,
    `game` VARCHAR( 50 ) ,
    `rules` VARCHAR( 255 ) ,
    `contact_name` VARCHAR( 50 ) NOT NULL ,
    `phone` INT( 15 ) ,
    `email` VARCHAR( 100 ) ,
    `website` VARCHAR( 100 ) ,
    `event_id` INT( 10 ) NOT NULL AUTO_INCREMENT ,
    PRIMARY KEY ( `event_id` )
    )


  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    try this


    CREATE TABLE `tournaments` (
    `venue` VARCHAR( 150 ) NOT NULL ,
    `address` VARCHAR( 255 ) NOT NULL ,
    `date` DATE NOT NULL ,
    `registration` TIME NOT NULL ,
    `game_start` TIME NOT NULL ,
    `finish_time` TIME NOT NULL ,
    `prize` INT( 20 ) ,
    `buy_in` INT( 20 ) ,
    `re_buys` INT( 20 ) ,
    `additional_info` VARCHAR( 255 ) ,
    `game` VARCHAR( 50 ) ,
    `rules` VARCHAR( 255 ) ,
    `contact_name` VARCHAR( 50 ) NOT NULL ,
    `phone` INT( 15 ) ,
    `email` VARCHAR( 100 ) ,
    `website` VARCHAR( 100 ) ,
    `event_id` INT( 10 ) NOT NULL AUTO_INCREMENT ,
    PRIMARY KEY ( `event_id` )
    )



    you were previous specifying DATE (20) - which was causing the error


  • Advertisement
  • Registered Users Posts: 673 ✭✭✭Bananna man


    Cheers mate, that sorted it!! :)


Advertisement