Results 1 to 2 of 2

Thread: Making an sql table x2 error

  1. #1
    Join Date
    Mar 2011
    Posts
    2,174
    Thanks
    61
    Thanked 121 Times in 117 Posts
    Blog Entries
    4

    Default Making an sql table x2 error

    Hi everyone,,,

    PHP Code:
    CREATE TABLE jenChat_Users (
      
    UserID int(10unsigned NOT NULL auto_increment,
      
    UserName varchar(20NOT NULL default '',
      
    LastUpdate timestamp(14NOT NULL,
      
    PRIMARY KEY  (UserID)
    );
    CREATE TABLE jenChat_Messages (
      
    MessageID int(10unsigned NOT NULL auto_increment,
      
    UserID int(10unsigned NOT NULL default '0',
      
    Posted timestamp(14NOT NULL,
      
    Message varchar(255NOT NULL default '',
      
    PRIMARY KEY  (MessageID)
    ); 
    That code is causing this error




    Error
    SQL query:

    CREATE TABLE jenChat_Users(

    UserID int( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
    UserName varchar( 20 ) NOT NULL default '',
    LastUpdatetimestamp( 14 ) NOT NULL ,
    PRIMARY KEY ( UserID ) );



    MySQL said:

    #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 '(14) NOT NULL,
    PRIMARY KEY (UserID)
    )' at line 4





    Any help would be great!

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    I've never defined a size for a TIMESTAMP column. In any case, 14 is too few characters for a mysql timestamp. just write `LastUpdate` TIMESTAMP NOT NULL.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •