I’m trying to display unavaliable dates by disabling them over the admin control panel which creates a table of dates that are non working days. Right now i thought of a way to display /”yyyy-mm-dd”,/ perfectly, tried it in regular php, works, i put it in js, no i get just the first value, the first date in this case 23rd of december (2021-12-23), how do i display every value of the $date. Here’s my code that you might find relevant
<?php
$sql = "SELECT * FROM tbl_closed ORDER BY date ASC";
$res = mysqli_query($conn, $sql);
if($res==TRUE)
{
$count = mysqli_num_rows($res);
if($count>0)
{
while($rows=mysqli_fetch_assoc($res))
{
$date=$rows['date'];
?>
<script type="text/javascript">
$(function () {
var disabledDate = [<?php echo ""$date","; ?>];
$('#datetimepicker1').datetimepicker({
disabledDates: disabledDate
});
});
</script>
<?php echo ""$date",";?> //tried running this test to see what i get, i get what i want when outside of the js [], "2021-12-23", "2021-12-24", "2021-12-31", "2022-01-01",
<?php
}
}
else{}
}
?>