Click here to Skip to main content
15,790,917 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello I'm trying to create a calendar with booked dates for a while now but with no succes I was wondering if someone else could see what is going wrong. I have alreasy tried 2 ways.
first one is a very big calendar on the website that shows booked dates. Though it does do the job its just not exactly what I want to have.

it's more like my second version.
an input type of text what when you click on it will show a calendar with dates that you can pick.
this is the source code:
<?php include "config.php"; ?>
<html lang="en">
<meta charset="utf-8">
<title>jQuery UI Datepicker - Display multiple months</title>
<link rel="stylesheet" href="">
<script src=""></script>
<script src=""></script>
 $huis_ID = "1";

 $sql = "SELECT * FROM reserveringen WHERE huis_ID = ?";
 $stmt = $conn->prepare($sql);
 $stmt->bind_param("i", $huis_ID);
 $result = $stmt->get_result();
 $data = $result->fetch_all(MYSQLI_ASSOC);
 if ($data):
        <?php foreach($data as $row): ?>
            $start_datum = date('d-m-Y', strtotime($row['start_datum']));
            echo $start_datum , "<br>"; 
            $eind_datum = date('d-m-Y', strtotime($row['eind_datum']));
            echo $eind_datum , "<br>"; 
        <?php endforeach ?>
    <?php else: ?>
        No data found
    <?php endif ?>


$(function() {
    $( "#datepicker" ).datepicker({
    numberOfMonths: 1,
    showButtonPanel: true,
$(function() {
    $( "#datepicker1" ).datepicker({
    numberOfMonths: 1,
    showButtonPanel: true,
<p>start_date: <input type="text" id="datepicker" name ="datepicker"></p>

<p>end_date: <input type="text" id="datepicker1" name ="datepicker1"></p>


what it does is it shows the calendar and you are not allowed to go back in months. this is what I want to have but now I want to have blocked (in red) dates. based on the booked dates that are in the db

in the foreach loop you will see the dates shown now I want to use these dates to create the blocked (in red) dates how do I fix this?

What I have tried:

So first I tried to make a big calendar but this just showed booked dates I don't want that. I want kinda what I have now but with the booked dates
Updated 3-Jul-22 5:11am
Member 15627495 3-Jul-22 3:18am    
explode the functionnality in several unity.

code the first, the simplest posible.
then code ( add ) the second functionnality.
and so , and so ...
where do you have an error ?
minoesje minoes 3-Jul-22 10:12am    
I don't have errors? I just don't know how to add my mysqli dates in my calendar en block them
minoesje minoes 3-Jul-22 4:03am    
?? I'm not understanding? These are the two last things that need to be done?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900