Таблица номеров выглядит следующим образом:
Код: Выделить всё
id rm_number capacity bed_no class hostel is_vaccant
40 1 5 1A,1B,1C,1D,1E 27 7 1
41 2 4 2A,2B,2C,2D 28 7 0
42 3 3 3A,3B,3C 29 10 1
43 4 4 4A,4B,4C,4D 30 10 1
44 5 6 5A,5B,5C,5D,5E,5F 27 7 1
45 6 7 6A,6B,6C,6D,6E,6F,6G 29 10 1
Код: Выделить всё
id first_name stud_id hostel class room bed status
175 siraj WPGH00175 7 28 41 2A P
176 nesru WPGH00176 7 28 41 2B P
177 faizal WPGH00177 7 28 41 2C P
179 mashoor WPGH00179 7 28 41 2D G
180 dsf WPGH00180 7 27 40 1A G
181 ee WPGH00181 7 27 40 1B P
Когда я использую свой код следующим образом:
Модель:
Код: Выделить всё
public function view_room_status($num,$offset)
{
$this->db->select('rooms.*,class.name as class_name,hostel.name as hostel_name,student_hostel.status,student_hostel.id as s_id');
$this->db->join('class','class.id=rooms.class');
$this->db->join('hostel','hostel.id=rooms.hostel');
$this->db->join('student_hostel','rooms.id=student_hostel.room','left');
$this->db->group_by('rooms.id');
$query=$this->db->get('rooms',$num,$offset)->result();
return $query;
}
Код: Выделить всё
Код: Выделить всё
sl no room class hostel Bed
1 1 Periyar1 Periyar 1A,1B,1C,1D,1E
2 2 Periyar2 Periyar 2A,2B,2C,2D
3 3 Pamba1 Pamba
4 4 Pamba2 Pamba
5 5 Periyar1 Periyar
6 6 Pamba1 Pamba
Подробнее здесь: https://stackoverflow.com/questions/400 ... m-an-array
Мобильная версия