Hello I'm looking to make a daily loop from an start date to an end date and execute some sql for each day. Something like:
$start_date = "2007-10-20";
$end_date = "2007-12-10";
$loop_date = $start_date;
while ($loop_date <= $end_date) {
echo $loop_date;
echo "<br>";
$loop_date++;
}
The problem with this code is that the variables are treated as text instead of date values. Because of this the output is something like:
2007-10-20
2007-10-21
2007-10-22
2007-10-23
2007-10-24
2007-10-25
2007-10-26
2007-10-27
2007-10-28
2007-10-29
2007-10-30
2007-10-31
2007-10-32
2007-10-33
[...]
2007-10-41
2007-10-42
2007-10-43
2007-10-44
2007-10-45
and so on... it will never end, because it will stay in an endless loop. I need a way to loop from a start day and an end day with the daily dates.
I search online, but couldn't find a solution that worked.
Any ideas?
Thanks!
G