PDA

View Full Version : posts yesterday (read me)


corsacrazy
03-02-2003, 08:28 PM
this is the code 4 displaying total posts today:


// number of posts today
$datecut = mktime(0,0,0,date("m"), date("d"), date("y"));
$getpoststoday=$DB_site->query_first("SELECT count(*) AS count FROM post WHERE dateline>='$datecut'");
$poststoday=$getpoststoday[count];



so please could you help me modify it to display total posts yesterday ! cheers !

EchoHype.com
03-02-2003, 08:37 PM
couldn't you just change the 2nd date value for day"d" to -1?

Xenon
03-02-2003, 08:45 PM
@echo: nope, because then it would display all posts from yesterday AND today ;)

use this:// number of posts yesterday
$datecut = mktime(0,0,0,date("m"), date("d"), date("y"));
$getpoststoday=$DB_site->query_first("SELECT count(*) AS count FROM post WHERE dateline<='$datecut' AND dateline>=".($datecut-24*3600));
$poststoday=$getpoststoday[count];

EchoHype.com
03-02-2003, 08:51 PM
ahh alrighty.

hehe :)

corsacrazy
03-03-2003, 07:32 PM
nice one xen master cheers