2017-04-23 125 views
-1

ORDER BY不起作用。我尝试过我知道的方式,但它不会排序,为什么?排序不工作Codeigniter

回报:调用一个成员函数result_array()上布尔

public function getDetailbyClsandSection($class_id, $section_id, $exam_id) { 
    $query = $this->db->query("SELECT exam_schedules.*,subjects.name,subjects.type FROM exam_schedules,teacher_subjects,exams,class_sections,subjects WHERE exam_schedules.teacher_subject_id = teacher_subjects.id and exam_schedules.exam_id =exams.id and class_sections.id =teacher_subjects.class_section_id and teacher_subjects.subject_id=subjects.id and class_sections.class_id =" . $this->db->escape($class_id) . " and class_sections.section_id=" . $this->db->escape($section_id) . " and exam_id =" . $this->db->escape($exam_id) . " and exam_schedules.session_id=" . $this->db->escape($this->current_session));  
    return $query->result_array(); 
} 
+0

500错误是服务器错误,而不是MySQL的。你可能犯了一些语法错误。 – learner

+0

@learner有什么办法呢? –

+0

@learner当没有任何语法错误存在时它仍然不起作用 –

回答

0
$query = $this->db->query("SELECT exam_schedules.*,subjects.name,subjects.type FROM exam_schedules,teacher_subjects,exams,class_sections,subjects WHERE exam_schedules.hide = 'N' and exam_schedules.teacher_subject_id = teacher_subjects.id and exam_schedules.exam_id =exams.id and class_sections.id =teacher_subjects.class_section_id and teacher_subjects.subject_id=subjects.id and class_sections.class_id =" . $this->db->escape($class_id) . " and class_sections.section_id=" . $this->db->escape($section_id) . " and exam_id =" . $this->db->escape($exam_id) . " and exam_schedules.session_id=" . $this->db->escape($this->current_session) . " ORDER BY exam_schedules.date_of_exam ASC"); 
+0

现在工作 –