2017-04-19 84 views
0

笨查詢陣列忽略行的第一行,但顯示的休息,這可能是這樣做的原因??? ...笨查詢數組不顯示第一個記錄,但沒有別的顯示

function index() { 
$date = date('Y-m-d'); 
/* $result = $this->smsgateway->SendAbsentSMS(date('Y-m-d', $this->customlib->datetostrtotime($date))); */ 
$student = $this->stuattendence_model->student_daily_attendance($date); 
print_r($student); 
} 

public function student_daily_attendance($date) { 
    $this->db->select('students.id,students.firstname,students.lastname,students.guardian_phone,students.roll_no,classes.id,classes.class,sections.id,sections.section,student_attendences.*,student_session.id,student_session.class_id,student_session.section_id,student_session.session_id'); 
    $this->db->from('students'); 
    $this->db->join('student_session', 'student_session.student_id = students.id'); 
    $this->db->join('classes', 'classes.id = student_session.class_id'); 
    $this->db->join('sections', 'sections.id = student_session.section_id'); 
    $this->db->join('student_attendences', 'student_attendences.student_session_id = students.id'); 
    $this->db->where('date', $date); 
    $query = $this->db->get(); 
     return $query->result_array(); 
    } 
+0

粘貼「student_daily_attendance」函數的代碼。 –

+0

'student_daily_attendance()'函數在'stuattendence_model'中做了什麼? –

+0

粘貼功能 –

回答

0
function index() { 
$date = date('Y-m-d'); 
/* $result = $this->smsgateway->SendAbsentSMS(date('Y-m-d', $this->customlib->datetostrtotime($date))); */ 
$student = $this->stuattendence_model->student_daily_attendance($date); 
print_r($student); 
} 

public function student_daily_attendance($date) { 
    $this->db->select('students.id,students.firstname,students.lastname,students.guardian_phone,students.roll_no,classes.id,classes.class,sections.id,sections.section,student_attendences.*,student_session.id,student_session.class_id,student_session.section_id,student_session.session_id'); 
    $this->db->from('students'); 
    $this->db->join('student_session', 'student_session.student_id = students.id'); 
    $this->db->join('classes', 'classes.id = student_session.class_id'); 
    $this->db->join('sections', 'sections.id = student_session.section_id'); 
    $this->db->join('student_attendences', 'student_attendences.student_session_id = students.id'); 
    $this->db->where('DATE(date)', $date); 
    $query = $this->db->get(); 
     return $query->result_array(); 
    } 

只需更改此處的查詢$ this-> db-> where('DATE(date)',$ date);

+0

nopes它仍然顯示一個較少的記錄。 –

+0

什麼是日期字段的數據類型 –

+0

道歉Rajat,數據庫表有一個我刪除的學生的記錄,因此它顯示了一個較少的記錄。 –

0

道歉,數據庫表有一個我刪除的學生的記錄,因此它顯示少一個記錄。