I want to count all the posts from the user, from the last hour. This is my code:
$all_user_recent_posts=mysql_query("select * from user_post where user_id=$userid and where post_time >= DATE_SUB(NOW(),INTERVAL 1 HOUR);");
$count_user_recent_posts=mysql_num_rows($all_user_recent_posts);
This code doesn't work(it has the value 0). But when I delete and where post_time >= DATE_SUB(NOW(),INTERVAL 1 HOUR)
, it does work, but it show me ALL the post of the user, and not posts from the last hour. Code:
$all_user_recent_posts=mysql_query("select * from user_post where user_id=$userid;");
$count_user_recent_posts=mysql_num_rows($all_user_recent_posts);