有guest_name和guest_number以及两个在while循环中从数据库中获取记录的变量。
while( $row = $result-> fetch_assoc() )
{
$name = $row['getaway_name']." <br>";
$start = $row['check_in_date']." <br>";
$end = $row['check_out_date']." <br>";
$guest_n[]= $row['guest_name'];
$guest_number[]= $row['guest_phone'];
//$cp = array();
$arr1 = range(strtotime($row['check_in_date']),strtotime($row['check_out_date']), "86400");
//$arr2 = range(strtotime($row['check_out_date']),strtotime($row['check_in_date']), "86400");
array_walk_recursive($arr1, function(&$element) { $element = date("j-n-Y", $element); });
//array_walk_recursive($arr2, function(&$element) { $element = date("d-n-Y", $element); });
foreach ($arr1 as $value)
{
$arr2[]= $value;
}
$arrt= (array_merge($guest_n, $guest_number));
print_r($arrt);
foreach($arrt as $val)
{
$arr_t= $val;
echo 'foreach' .$arr_t;
}
我想通过从数据库中提取来显示日历上的用户名和电话号码,例如一个用户从21-23预订了房间,第二个用户从26-29预订了房间,所以我想在日期显示用户信息,在我的情况下,所有日期都有相同的信息..
<script type="text/javascript">
// Add New Dates and Block Out Booked Days Below
/*var unavailableDates1 = ["20-5-2016", "21-5-2016", "22-5-2016", "23-5-2016", "5-6-2016", "7-6-2016", "8-6-2016",
"15-6-2016", "16-6-2016", "25-6-2016", "26-6-2016", "27-6-2016", "28-6-2016", "14-2-2016",
"15-7-2016", "16-7-2016", "17-7-2016", "18-7-2016", "19-7-2016","20-7-2016","21-7-2016",
]; */
var unavailableDates = <?php echo json_encode($arr2); ?>;
var unavailab = <?php echo json_encode($arr_t); ?>;
document.write(unavailab);
document.write(unavailableDates);
function unavailable(date) {
dmy = date.getDate() + "-" + (date.getMonth() + 1 ) + "-" + date.getFullYear();
if($.inArray(dmy, unavailableDates) == -1) {
return [true, ""];
}else {
/// -> from this line i want to show the data that are coming from user
return [false, "",unavailab];
}
}
$(function() {
$("#Datepicker1").datepicker({
numberOfMonths:3,
beforeShowDay: unavailable
});
});
</script>
Please help