• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Call the data of yesterday (00:00 hrs to 00:00 hrs)

#1
Hi,

I need to call some data from database for yesterday, I wrote this:
Code:
$db->fetchOne('
        SELECT COUNT(resource_download_id) AS total
        FROM xf_resource_download
        WHERE last_download_date > ' . $lastDay . '
But ($lastDay) is calling the data based on "last 24 hours", while I want from yesterday at 00:00 hrs to today at 00:00 hrs, so the counter will update the value at 00:00 hrs from each day.

Any idea guys?
 
#3
WHERE last_download_date >UNIX_TIMESTAMP_START AND last_download_date < UNIX_TIMESTAMP_END

Replace UNIX_TIMESTAMP_START and UNIX_TIMESTAMP_END with the correct timestamps.

Get the timestamps calculated here:
http://www.epochconverter.com/
Thanks but I don't want to put specific date (one date) (i.e 13-01-2016 to 14-01-2016)
Date should be variable so the counter will be auto updated every 24 hours