gpt4 book ai didi

php - Codeigniter查询数组不显示第一条记录,但显示其他记录

转载 作者:行者123 更新时间:2023-11-29 19:06:09 25 4
gpt4 key购买 nike

Codeigniter 查询数组忽略第一行,但显示其余行,这可能是什么原因???...

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();
}

最佳答案

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();
}

只需更改 where 查询,如下所示 $this->db->where('DATE(date)', $date);

关于php - Codeigniter查询数组不显示第一条记录,但显示其他记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43487066/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com