• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript datepicker disable dates that are in db


Well-Known Coder
Does anyone know how I can disable certain dates in my calendar based on the dates that are in the db??

so if the db has start_date (start_datum) 1-7-2022 and end_date (eind_datum) 3-7-2022. Then I want the code to disable all 3 of those days.
<?php include "config.php"; ?>
<html lang="en">
<meta charset="utf-8">
<title>jQuery UI Datepicker - Display multiple months</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></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();
 while ($row = $result->fetch_assoc()) {
     echo $row['ID'];
     echo $row['start_datum'];
     echo $row['eind_datum'];

$(function() {
    $( "#datepicker" ).datepicker({
    numberOfMonths: 1,
    showButtonPanel: true,
    altFormat: 'dd-MM-yyyy',
<p>Date: <input type="text" id="datepicker" name ="datepicker"></p>

<?php } ?>

Picture of what it looks right now
Top Bottom