Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the latest 24hrs content? 1

Status
Not open for further replies.

blekfis

Programmer
Oct 19, 2001
38
SE
How do I get things out from a table that has been submitted the latest 24hrs?

The table I'd like to get things out of is built on this:
CREATE TABLE nuke_stories (
pn_sid int(11) NOT NULL auto_increment,
pn_catid int(11) NOT NULL default '0',
pn_aid varchar(30) NOT NULL default '',
pn_title varchar(255) default NULL,
pn_time datetime default NULL,
pn_hometext text,
pn_bodytext text NOT NULL,
pn_comments int(11) default '0',
pn_counter mediumint(8) unsigned default NULL,
pn_topic tinyint(4) NOT NULL default '1',
pn_informant varchar(20) NOT NULL default '',
pn_notes text NOT NULL,
pn_ihome tinyint(1) NOT NULL default '0',
pn_themeoverride varchar(30) NOT NULL default '',
pn_language varchar(30) NOT NULL default '',
pn_withcomm tinyint(1) NOT NULL default '0',
pn_format_type tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (pn_sid)
) TYPE=MyISAM;

pn_time is in this format: 2003-01-29 16:39:16
 
Something like this:

SELECT $column[sid], $column[catid], $column[aid], $column[title], $column[hometext], $column[bodytext], UNIX_TIMESTAMP($column[time]), $column[comments], $column[counter], $column[notes] FROM $table WHERE $column[time] < "24hrs old"

You see what I mean...?
 
You could use:
[tt]
WHERE pn_time > DATE_SUB(NOW(), INTERVAL 1 DAY)
[/tt]


-----
ALTER world DROP injustice, ADD peace;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top