I need some help with this one please.
I am trying to return only the rows from the mysql table where the difference between today's date and 'next_due' is 7 days or more. The code I have so far is...
$stmt = $conn->prepare("SELECT * FROM activities WHERE userId = ? AND status = ? ");
$stmt->bind_param("ss", $userId, $status);
$stmt->execute();
$result = $stmt->get_result();
if($result->num_rows === 0) echo "zero";
else {
while($row = mysqli_fetch_array($result)) {
$activity_id = $row['id'];
$title = $row['title'];
$next_due = $row['next_due'];
$next_due = strtotime($next_due);
$next_due = date("d/m/Y", $next_due);
}
}
This returns all rows where the $status is set to 'open', but I only want to return those rows where the difference between today's date and the date entered in 'next_due' is greater than 7 days.
Help is appreciated