Good Evening,
I have a function that is use to filter data based on the due_date. The activities table has a defined date field (due_date) that is to be compared with the current date. However, I am not getting the correct results. I have been researching but can not seem to determine the issue other than the variable and field are different formats. Have not been able to determine how to correct the issue.
[php]
function find_activities_overdue($overdue){
global $con;
$tday = date(‘Y-m-d’); // current date
$sql = “SELECT *”;
$sql .= " FROM activities";
if ($overdue) {
$sql .= " WHERE (due_date < $tday)";
} else {
$sql .= " WHERE (due_date >= $tday)";
}
$sql .= " ORDER BY due_date DESC";
$result = mysqli_query($con,$sql);
if($result){
$results = while_loop($result);
} else {
check_query($result);
}
return $results;
}
[/php]
Any help would be greatly appreciated.
Rod
help.txt (698 Bytes)