I need a mysql statement to pull records depending on the current day, week, month, and year.
I have a column that’s formatted as timestamp so I know I am good there.
Example:
$sql_total_users_week = "SELECT * FROM users WHERE reg_date = thisweek()";
$result_total_users_week = mysql_query($sql_total_users_week);
$records_total_users_week = mysql_num_rows($result_total_users_week);
for some reason the records are pulling by the day and not the week. Cant seem to figure out what I am doing wrong.
You may want to take a look at the MySQL date and time reference.