Currently building a pagination class and i´m having a tiny problem. The first page looks fine but when i go to page 2 the rows has the same data -1 row from the top. (FaaPz/Slim-PDO)
Get users
$stmt = $this->pdo->select()->from($this->table);
$currPage = /* GET */;
$limit = 5;
$offset = $limit;
$row = $limit;
if ($currPage == 1) {
$offset = $limit ;
$row = 0;
}else{
$offset = ($offset * $currPage);
$row = ($row * $currPage - $limit );
}
$stmt = $stmt->limit( (int)$offset , (int)$row );
$stmt = $stmt->execute();
$data = $stmt->fetchall();
Still buggy