...

View Full Version : Simple MySQL Query



medicatedsquid
06-26-2007, 11:19 PM
Simple question: why doesn't this work?


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` )
)

BigBob
06-26-2007, 11:31 PM
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 :thumbsup:

Daemonspyre
06-26-2007, 11:37 PM
Why not:



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.

BigBob
06-26-2007, 11:39 PM
^^ Or use the more efficient query :cool:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum