Date comparison in MySQL and PHP
I'm sure my issue is simple to resolve, but I've had no luck. I want to retrieve a set of information from a database for rows that were submitted between two dates. These two dates will be provided by the user in a form and saved in the variables $start and $end.
The dates stored in the database were saved as TIMESTAMP.
$start = strtotime($_POST['start']);
$startdate = date("Y-m-d", $start);
$end = strtotime($_POST['end']);
$enddate = date("Y-m-d", $end);
$list = mysql_query("SELECT id FROM collection WHERE (category= 'subject') AND ($startdate < submitted) AND (submitted < $enddate)");
Echoing out the answer gives me 0 every time regardless of the answer I'm expecting. I really can't see what I'm doing wrong.