PHP datetime SELECT field today?

I can't get my select statement to filter the datetime column today: I only need the row number (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 characters of datetime for comparison? sib (due_date, 0.10)?

thanks jm

+3
source share
2 answers

First you need to convert due_dateto DATEby doing the following:

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

Just use CURRENT_DATE:

$query = mysql_query("SELECT * FROM wds_sec1tasks WHERE due_date = CURRENT_DATE");
+2
source