Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple MySQL Query

    Simple question: why doesn't this work?

    Code:
     CREATE TABLE `posts` (
    `id` INT NOT NULL AUTO_INCREMENT ,
    `title` NOT NULL TEXT,
    `date` TEXT NOT NULL ,
    `time` TEXT NOT NULL ,
    `content` TEXT NOT NULL ,
    PRIMARY KEY ( `id` )
    )

  • #2
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
     CREATE TABLE `posts` (
    `id` INT NOT NULL AUTO_INCREMENT ,
    `title` TEXT NOT NULL,
    `date` TEXT NOT NULL ,
    `time` TEXT NOT NULL ,
    `content` TEXT NOT NULL ,
    PRIMARY KEY ( `id` )
    )
    You just had one of them the wrong way around

  • #3
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Why not:

    Code:
    CREATE TABLE `posts` (
     `id` INT NOT NULL AUTO_INCREMENT ,
     `title` TEXT NOT NULL,
     `dateTimestamp` DATETIME DEFAULT CURRENT_TIMESTAMP,
     `content` TEXT NOT NULL ,
     PRIMARY KEY ( `id` )
    )
    If you specify your fieldtypes to your data, you will get much better results with your queries, keys, and searches.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #4
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ^^ Or use the more efficient query


  •  

    Posting Permissions

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