Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

MySQL error

  • 18-11-2005 04:39PM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    The TIME datatype doesn't take any arguments.

    Try just

    "registration TIME NOT NULL"


  • Registered Users, Registered Users 2 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, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    Post up the full query there...


  • Registered Users, Registered Users 2 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, Registered Users 2 Posts: 673 ✭✭✭Bananna man


    Cheers mate, that sorted it!! :)


Advertisement