I have this piece of code which i am using on another area of my website, basically it counts the rows of data in a database, now it works fine.
Now i want to do another count on another database however this time the date column is date time format, and the query doesn’t seem to work.
Below is the piece of code i use to get the day from two days ago
$day_ago2 = date('Y-m-d', mktime(0, 0, 0, date("m") , date("d") - 1, date("Y")));
And below is the mysql code,
SELECT * FROM page_views WHERE date='$day_ago2' and member ='$site_id'
ANy help would be appreciated.
Thanks
Use
DATEDIFF()function