220061
Well-Known Coder
hello! i'm making a calendar that shows which days have been booked and which are available.
In my db I have two important cols for this called: start_date and end_date (translation is start_datum and eind_datum)
Now I'm trying to make the days that are booked have the red booked label. the problem starts when I do this:
(written in d-m-y)
reservation is from 14-06-2022 till 18-06-2022
14-06-2022 = start_datum
18-06-2022 = eind_datum
those two dates turn red like they should be but all the dates in between don't change at all. I have tried to use a for loop to get this fixed but it's showing no difference. I'm out of idea's and was wondering if someone else knew what to do
In my db I have two important cols for this called: start_date and end_date (translation is start_datum and eind_datum)
Now I'm trying to make the days that are booked have the red booked label. the problem starts when I do this:
(written in d-m-y)
reservation is from 14-06-2022 till 18-06-2022
14-06-2022 = start_datum
18-06-2022 = eind_datum
those two dates turn red like they should be but all the dates in between don't change at all. I have tried to use a for loop to get this fixed but it's showing no difference. I'm out of idea's and was wondering if someone else knew what to do
PHP:
if(in_array($date, $bookings)){
// misschien lukt het nog met de tutorials erbij sze hebben er namelijk nog mee rgemaakt
print_r($bookings);
// echo "<br>";
// echo $date;
// echo "<br>";
$timestampStart_datum = strtotime($start_datum);
//schets voor mktime()
//mktime(Hour, minute , second, month, day, year);
$testing = mktime(0, 0, 0, $timestampStart_datum);
echo $testing, "<---- dit is de variable testing";
echo "<br>";
$timestampEind_datum = strtotime($eind_datum);
$testingEind = mktime(0, 0, 0, $timestampStart_datum);
echo $testingEind, "<---- dit is de variable testing eind";
echo "<br>";
$seconds = 24 * 60 * 60;
echo "<br>";
// echo $start_datum;
// echo "<br>";
// echo $eind_datum;
// echo "<br>";
if($start_datum < $date){
echo "testing";
}else{
echo "testing gone wrong????";
}
echo "<br>";
echo $currentDay . "<--- dit is de current day";
echo "<br>";
echo $testing . "<--- dit is de testing day";
echo "<br>";
echo $testingEind . "<--- dit is de testingEind day";
echo "<br>";
echo $today . "<--- dit is de today day";
echo "<br>";
echo $date . "<--- dit is de date day";
echo "<br>";
for ($date = $testing; $date <= $testingEind; $date++) {
//$next = date("F j, Y", $date);
$calendar.="<td class='$today'><h4>$currentDay</h4><a class='btn btn-danger btn-xs'>booked</a></td>";
}
// $calendar.="<td class='$today'><h4>$currentDay</h4><a class='btn btn-danger btn-xs'>booked</a></td>";
}else{
$calendar.="<td class='$today'><h4>$currentDay</h4><a class='btn btn-success btn-xs'>Beschrikbaar</a></td>";
}
$currentDay++;
$dayOfWeek++;
}