Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Codeigniter查询数组不';不显示第一条记录,但显示其他记录_Php_Mysql_Codeigniter - Fatal编程技术网

Php Codeigniter查询数组不';不显示第一条记录,但显示其他记录

Php Codeigniter查询数组不';不显示第一条记录,但显示其他记录,php,mysql,codeigniter,Php,Mysql,Codeigniter,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

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

只需更改where查询,如$this->db->where('DATE(DATE)',$DATE)

抱歉,数据库表中有一条我删除的学生记录,因此显示的记录少了一条

粘贴“student_daily_Attention”函数的代码。
student_daily_Attention()
函数在您的
student_模型中做什么
?粘贴函数日期字段的数据类型是什么道歉,数据库表中有一条我删除的学生的记录,因此它显示的记录少了一条。好的。你也可以使用上面的代码。它会给你更准确的结果苏尔·拉贾特·古普塔,非常感谢先生的帮助:)
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();
    }