I would like to select from database 10 most popular posts posted in last 24 hours based on likes. In database for each post I stored time when the post was posted using date("Y-m-d H:i:s") in column post_date.
I need something like this:
$most_popular = mysqli_query($mysqli_connect, "SELECT * FROM posts WHERE (time() - post_date) < 86400 ORDER BY likes DESC LIMIT 10");