Forum Moderators: coopster

Message Too Old, No Replies

Future tasks showing up in the overdue tasks page

         

jbearnolimits

2:44 am on Nov 15, 2022 (gmt 0)

Top Contributors Of The Month



I am not sure what is going on here. I have 3 pages. One for tasks due, one for tasks overdue, and one for future tasks due. The dates in the database are all correct and everything is working. BUT for some reason the tasks overdue page is showing tasks that are set for the next year. For example, the first task may be set to take place on 12/01/22 and it shows on the future tasks due page. BUT the next task may be set to 1/01/23 and it shows it on the tasks overdue page. I can't figure out why.

Here is the code to get the tasks on the overdue page:

<?php

date_default_timezone_set("America/Los_Angeles");

$Task1DueDate = DATE('m/d/Y');

$sql = "SELECT UserID, FirstName, LastName, Phone, HomeAddress, ListName, Task1, Task1DueDate FROM Tasks WHERE ListName = 'FSBO' AND Task1DueDate < '$Task1DueDate' AND Task1 IS NOT NULL OR ListName = 'Expired' AND Task1DueDate < '$Task1DueDate' AND Task1 IS NOT NULL OR ListName = 'FSBO In Escrow' AND Task1DueDate < '$Task1DueDate' AND Task1 IS NOT NULL OR ListName = 'FSBO Fell Out Of Escrow' AND Task1DueDate < '$Task1DueDate' AND Task1 IS NOT NULL";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<div class=\"OuterDatabaseRowType2\">
<div class=\"InnerDatabaseRowType2ProfilID\"><ul class=\"second\"><li class=\"second\"><a href=\"../CompleteOverdueTask.php/?UserID=" . $row["UserID"] . "&Task1DueDate=" . $row["Task1DueDate"] . "&ListName=" . $row["ListName"]. "&Phone=" . $row["Phone"] . "\">Complete Task</a></li></ul></div>
<div class=\"InnerDatabaseRowType2Name\">" . $row["FirstName"]. " " . $row["LastName"]. "</div>
<div class=\"InnerDatabaseRowType2Phone\">" . $row["Phone"]. "</div>
<div class=\"InnerDatabaseRowType2HomeAddress\"><textarea name=\"Task1\" id=\"Task1\" rows=\"5\" cols=\"45\">";?><?php echo str_replace(array('#HomeAddress#', '#FirstName#', '#LastName#'), array($row["HomeAddress"], $row["FirstName"], $row["LastName"]), $row["Task1"]);?><?php echo "</textarea> </div>
<div class=\"InnerDatabaseRowType2CreationDate\">" . $row["ListName"]. "</div>
<div class=\"InnerDatabaseRowType2Green\"></div>
</div>";
}
}

jbearnolimits

4:13 am on Nov 16, 2022 (gmt 0)

Top Contributors Of The Month



So the solution was to change the database column that held the date from being varchar to date. Problem solved.