РЕДАКТИРОВАТЬ:
все мои статусы:
- Работа из дома
- 8 часов
- 4 часа
- Отпуск
- Отпуск по болезни
Контроллер
$order_by = "id desc";
$where = [
'user_id' => $this->session->id,
'status' => '4 hours',
'status' => '8 hours',
'status' => 'Work From Home'
];
$this->Crud_model->fetch('record', $where, "", "", $order_by);
МОДЕЛЬ
public function fetch($table, $where = "", $limit = "", $offset = "", $order = "")
{
if (!empty($where)) {
$this->db->where($where);
}
if (!empty($limit)) {
if (!empty($offset)) {
$this->db->limit($limit, $offset);
} else {
$this->db->limit($limit);
}
}
if (!empty($order)) {
$this->db->order_by($order);
}
$query = $this->db->get($table);
if ($query->num_rows() > 0) {
return $query->result();
} else {
return FALSE;
}
}
Подробнее здесь: https://stackoverflow.com/questions/465 ... model-meth
Мобильная версия