日期选择器 - 从数据库加载预订日期并设置特定日期数组
我需要一些帮助 - 我尝试设置 setSpecificDate 以便我从数据库获取(并已格式化)的数组能够正确加载。当我打印 $dates_booked 时,格式是 100% 正确的“yyyy-mm-dd” - 任何帮助/建议将不胜感激。
有关日期选择器/相关代码的更多信息:http://www.triconsole.com/php/calendar_datepicker。预先
感谢!
我的代码:
$datesArray = Array();
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$datesArray[] = $row['reserved_date'];
$dates_booked=implode(",",$datesArray);
$arrtrans = array();
$arrtrans[","] = '"'.",".'"';
$dates_booked = strtr($dates_booked,$arrtrans);
$dates_booked= '"'.$dates_booked.'"';
}
$myCalendar = new tc_calendar("date5", true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setDate(date('d'), date('m'), date('Y'));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(2012, 2020);
$myCalendar->dateAllow(date("Y-m-d"), '2020-01-01');
$myCalendar->setDateFormat('j F Y');
//$myCalendar->setHeight(350);
// $myCalendar->autoSubmit(true, "form1");
$myCalendar->setAlignment('left', 'bottom');
// Problematic Line
$myCalendar->setSpecificDate(array('.$dates_booked.'
), 0, '');
$myCalendar->writeScript();
I need some help - I have tried setting setSpecificDate so that the array I fetch (and have formatted) from the db will load correctly. When I print $dates_booked the format is 100% correct "yyyy-mm-dd" - any help / advice will be appreciated.
More info about the datepicker / associated code : http://www.triconsole.com/php/calendar_datepicker.php
Thanks in advance!
My Code:
$datesArray = Array();
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$datesArray[] = $row['reserved_date'];
$dates_booked=implode(",",$datesArray);
$arrtrans = array();
$arrtrans[","] = '"'.",".'"';
$dates_booked = strtr($dates_booked,$arrtrans);
$dates_booked= '"'.$dates_booked.'"';
}
$myCalendar = new tc_calendar("date5", true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setDate(date('d'), date('m'), date('Y'));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(2012, 2020);
$myCalendar->dateAllow(date("Y-m-d"), '2020-01-01');
$myCalendar->setDateFormat('j F Y');
//$myCalendar->setHeight(350);
// $myCalendar->autoSubmit(true, "form1");
$myCalendar->setAlignment('left', 'bottom');
// Problematic Line
$myCalendar->setSpecificDate(array('.$dates_booked.'
), 0, '');
$myCalendar->writeScript();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个烂摊子:
完全没用。你只需要这个:
This mess:
is totally useless. Yuo need only this: