Here I access ‘date’ key values from rows of DB table. And I can echo these values, no problem.
[php] $res = $mysqli->query(“SELECT * FROM alfred ORDER BY id ASC”);
$row = $res->fetch_all(MYSQLI_ASSOC);
foreach ($row as $key => $value){
$availDate = $value['date'];
echo $availDate.'<br />';
}[/php]
This loop above shows all ‘date’ values from DB, in this case there are 3 dates- [tt]“2012-09-25”[/tt] [tt]“2012-09-27”[/tt] and [tt]“2012-09-29”[/tt].
But then I need to compare each of these ‘date’ values against values of [tt]$date->format(‘Y-m-d’)[/tt] from the code below and display each date with corresponding “busy” or “available” status into separate
[php] $date = new DateTime();
$endDate = new DateTime(’+10 day’);
for($date->format(‘Y-m-d’); $date->format(‘Y-m-d’) < $endDate->format(‘Y-m-d’); $date->modify(’+1 day’)){
if ($date->format(‘Y-m-d’) == $availDate){
echo ‘
} else {
echo ‘
}
}[/php]
The result I am getting now is table row that shows all the dates within the range as expected but “busy” status is showed only to the date of “2012-09-29” which is the last ‘date’ value of my $row array.
But in fact I need to show “busy” status also into