I have a query like this.
WHERE (timetable_id = '1'
OR timetable_id = '2'
OR timetable_id = '3'
OR timetable_id = '4'
OR timetable_id = '5'
OR timetable_id = '6')
AND exam_name_id = '5'
But I don't know how to execute this in Codeigniter.
I have tried this
while(@$i <= 6 {
$this->db->or_where('timetable_id',$this->input->post('timetable_id'.$i));
$i++;
}
$this->db->where('et.exam_name_id',5);
But the above command gives output like this
WHERE timetable_id = '1'
OR timetable_id = '2'
OR timetable_id = '3'
OR timetable_id = '4'
OR timetable_id = '5'
OR timetable_id = '6'
AND et.exam_name_id = '5'
This gives all the outputs. How to do that correctly?
Please Note in my query I have ()
braces.