php - Content is not visible in CodeIgniter calendar -


i can insert data database using codeigniter , data database, problem can't data date 1-9 (the data present in database). after 9th of month, data retrieved successfully.

controller:

function display($year=null,$month=null){     if (!$year) {         $year = date('y');     }     if (!$month) {         $month = date('m');     }      $this->load->model('calendar_model');      if ($day = $this->input->post('day')) {         $this->calendar_model->add_calendar_data("$year-$month-$day",$this->input->post('data')         );     }      $this->load->model('calendar_model');     $data['calendar']=$this->calendar_model->generate($year,$month);     $data['viewname']=('student/s_calendar');     $this->load->view('student/template',$data); } 

model:

function get_cal_data($year,$month){     $query=$this->db->select('date,data')->from('student_calender')->like('date',"$year-$month")->get();     $cal_data=array();     foreach($query->result() $row){         $cal_data[substr($row->date,8,2)]=$row->data;     }     return $cal_data; } 

use function calendar data codeignitor picks values past 9 because compares 2 characters in html page 2 characters of days database. number below 10 not match because in database saves day below 10 zero. use this

function get_calender_data($year,$month) {      $query = $this->db->select('date, data')->from('calendar') ->like('date',"$year-$month",'after')->get();      $cal_data = array();      foreach ($query->result() $row) {         if(substr($row->date,8,1)==0)         {             $cal_data[substr($row->date,9,1)] = $row->data;         }         else{         $cal_data[substr($row->date,8,2)] = $row->data;         }     }     return $cal_data; } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -