Код: Выделить всё
id | subject | achievement | staff_id
1 Target January 1150000 1
2 Target January 1350000 2
3 Target February 20000000 1
4 Target February 23500000 2
5 Target January 1500000 3
Код: Выделить всё
SELECT *
FROM `target`
WHERE `staff_id`='$id'
ORDER BY 'id' DESC
LIMIT 3,1
Вот код модели
Код: Выделить всё
$id = get_staff_user_id();
$this->db->get_where('target', array('staff_id' => $id));
$this->db->order_by('id', 'desc');
$this->db->limit(3, 1);
$query = $this->db->get();
return $query;
Подробнее здесь: https://stackoverflow.com/questions/570 ... tes-an-inv
Мобильная версия