• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passing query result into calendar class?

Hi everyone I cant seem to make this work, i got a function in the model where it returns the date of the query then store the sql result to an array $date_arr then pass that variable to the calendar just lyk in the User Guide but when i tried it,
the calendar only display the last query result of the date??can anyone help me here??thx

Model Code
function get_calendar_date($id,$month,$year){

     $sql = "Select Date FROM schedule WHERE resort_id = $id AND Month = $month AND Year = $year";
     $query = $this->db->query($sql);
     return $query;

Controller Code
$query = $this->Reservations->get_calendar_date($id,$month,$year);
        $date_arr = array();
        foreach($query->result() as $row):
        $date_arr[$row->Date] =  $row->Date;
        $data['cal'] = $this->calendar->generate($year,$month,$date_arr);

can anyone help me here?still havent find a way


yes its working its returning the result but the calendar only shows the last result not all.

What is the output of your print_r($date_arr);

heres the print_r

Array ( [28] => 28 [05] => 05 [26] => 26 )

yey i got it now the calendar cant display the date with 0 at front so i need to truncate the 0 at 05 for it to display ^_^ thx for helping

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.