PHP datetime field SELECT on today?

datetime, mysql, php, sql

Solution

You have to convert `due_date` in a `DATE` first by doing this:

SELECT * FROM wds_sec1tasks WHERE DATE(due_date) = '$u_today'

Problem

I can't get my select statement to filter a datetime column on today: I only need the rowcount (how many) ``` $u_today = date('Y-m-d'); $query = mysql_query("SELECT * FROM wds_sec1tasks WHERE due_date = '$u_today'"); $u_rows = mysql_num_rows($query); echo $u_rows; ``` Do I need to grab the left 10 chars of the datetime to compare? substr(due_date,0,10)? thanks, JM

Original source