Welcome Guest, Not a member yet? Register   Sign In
[Solved] Display multiple rows on calendar Question
#5

(12-19-2015, 08:01 PM)John_Betong Wrote: >>> But what I can not seem to make it work with my get function need example.

Try adding this extra line:

Quote:public function get_calendar_data($year, $month) {
       $cell_data = array();

       $this->db->where('year', $year);
       $this->db->where('month', $month);

       $this->db->where('calendar_id', TRUE); // EXTRA LINE NEEDS VALIDATING
       $query = $this->db->get();

If that doesn't work then echo last_query() and add " WHERE calendar_id > 0"

Been searching the web and found that this code below works fine now

PHP Code:
public function get_events($year$month) {
 
       $calendar = array();

 
       $this->db->where('year'$year);
 
       $this->db->where('month'$month);
 
       $query $this->db->get('calendar');

 
       $results $query->result_array();

 
       foreach ($results as $event) {

 
           if (array_key_exists$event['day'], $calendar ) ) {
 
                   
                $calendar
[$event['day']] = $calendar[$event['day']] .'<br />'anchor(base_url() .'report/events/'$year .'/'$month .'/'$event['calendar_id'], $event['data']);
 
               
            
} else {
 
               
                $calendar
[$event['day']] = anchor(base_url() .'report/events/'$year .'/'$month .'/'$event['calendar_id'], $event['data'])   ;
 
           }
 
       }

 
       return $calendar;
 
   

I have attached image proof.

Attached Files Thumbnail(s)
   
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
RE: Display multiple rows on calendar Question - by wolfgang1983 - 12-19-2015, 11:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB