Welcome Guest, Not a member yet? Register   Sign In
passing query result into calendar class?
#1

[eluser]jigen7[/eluser]
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
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
Code:
$query = $this->Reservations->get_calendar_date($id,$month,$year);
    
        $date_arr = array();
        foreach($query->result() as $row):
        $date_arr[$row->Date] =  $row->Date;
        endforeach;
        print_r($date_arr);
        $data['cal'] = $this->calendar->generate($year,$month,$date_arr);
        $this->load->view('calendar',$data);
#2

[eluser]jigen7[/eluser]
can anyone help me here?still havent find a way
#3

[eluser]Pygon[/eluser]
Nevermind...
#4

[eluser]jigen7[/eluser]
yes its working its returning the result but the calendar only shows the last result not all.
#5

[eluser]Pygon[/eluser]
What is the output of your print_r($date_arr);
#6

[eluser]jigen7[/eluser]
heres the print_r

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

[eluser]jigen7[/eluser]
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




Theme © iAndrew 2016 - Forum software by © MyBB