Это мой код контроллера:
Код: Выделить всё
$first = $this->db->query('SELECT MIN(recno) AS `first` FROM `daybook` ORDER BY recno DESC LIMIT 1')->row_array();
$firstID = $this->db->query("SELECT * FROM `daybook` where recno='$first[first]' ORDER BY recno ASC")->result_array();
//$firstID = $firstIDQuery->result_array();
$last = $this->db->query('SELECT MAX(recno) AS `last` FROM `daybook` ORDER BY recno DESC LIMIT 1')->row_array();
$lastID = $this->db->query("SELECT * FROM `daybook` where recno='$last[last]' ORDER BY recno")->result_array();
//$lastID = $lastIDQuery->result_array();
$id = 1;
if(!empty($id)){
$result = $this->db->query("SELECT * FROM daybook WHERE recno = $id")->result_array();
}
//$result = $resultQuery->result_array();
$data['currentID'] = $id;
$data['firstID'] = $first;
$data['lastID'] = $last;
$data['result'] = $result;
$this->load->view('BookKeeping/DayBookEntry', $data, FALSE);
Код: Выделить всё
[list]
[url=
[url=
Подробнее здесь: [url]https://stackoverflow.com/questions/53626234/how-to-move-to-next-entries-according-to-the-recno-in-codeigniter[/url]
Мобильная версия