2012-02-12 2 views
0

일부 도움이 필요합니다 - db에서 가져오고 배열 한 배열을 올바르게로드 할 수 있도록 setSpecificDate 설정을 시도했습니다. $ dates_booked를 출력 할 때 형식은 100 % 정확합니다. "yyyy-mm-dd"- 어떤 도움이나 조언도 부탁드립니다. 날짜 선택기/관련 코드에 대한날짜 선택기 - 예약 날짜를 데이터베이스 및 setSpecificDate 배열에서로드하십시오.

더 많은 정보를 원하시면 : 사전에 http://www.triconsole.com/php/calendar_datepicker.php

감사합니다!

내 코드 :

$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(); 

답변

0

이 엉망 :

    $datesArray[] = $row['reserved_date']; 
        $dates_booked=implode(",",$datesArray); 
        $arrtrans = array(); 
        $arrtrans[","] = '"'.",".'"'; 
        $dates_booked = strtr($dates_booked,$arrtrans); 
        $dates_booked= '"'.$dates_booked.'"'; 

완전히 쓸모. Yuo는 다음을 필요로합니다 :

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { 
    $datesArray[] = $row['reserved_date']; 
} 
/* ... */ 
$myCalendar->setSpecificDate($datesArray); 
+0

감사합니다. – Astrosaurus

관련 문제