I've got a database storing information entered by others and I am trying to be able to list entries that occurred between one date and including the next date. I'm sure it's been done before however I can't get it to work here. I know my default values don't work, so I could use help there as well. Here's what I'm working with:
$fromDate = "";
if (isset($_POST['fromDate'])) {
$fromDate = $_POST['fromDate'];
}
$toDate = "";
if (isset($_POST['toDate'])) {
$toDate = $_POST['toDate'];
}
mysql_select_db($database_custsupadmin, $custsupadmin);
$query_listCalls = sprintf("SELECT calls.created,
calls.agent_id,
agents.first_name,
agents.last_name,
calls.repair_order,
calls.`description`,
issues.issue_desc
FROM calls, agents, issues
WHERE calls.agent_id = agents.agent_id
AND issues.issue_id = calls.issue_id
AND calls.created BETWEEN '" . $fromDate . "' AND DATE_ADD('" . $toDate . "', INTERVAL 1 DAY)
ORDER BY calls.created DESC",
GetSQLValueString($fromDate, "date"),
GetSQLValueString($toDate, "date"));
I've updated this to what I am currently using and it works. I'm hoping that there is no problem with the code that could pose an issue in the future.