correct offset

This commit is contained in:
Your Name
2021-08-16 21:37:40 +03:00
parent f0761c95c6
commit 84d69e8385

View File

@@ -50,10 +50,10 @@ function api_books_kuri($category = 'knigi', $filter = 'all', $page = 1){
if ($page > 1){ if ($page > 1){
$offset = $limit * ($page - 1); $offset = $limit * ($page - 1);
$offset_str = ", $offset"; $offset_str = $offset;
} }
else { else {
$offset_str = ''; $offset_str = 0;
} }
if ($category == 'all'){ if ($category == 'all'){
@@ -78,9 +78,10 @@ function api_books_kuri($category = 'knigi', $filter = 'all', $page = 1){
return False; return False;
if (isset($db_count['count'])) if (isset($db_count['count']))
$count = $db_count['count']; $count = $db_count['count'];
$sql_books = "SELECT * FROM `price` $where AND `active` = 1 ORDER BY `price_id` DESC LIMIT $limit OFFSET $offset_str";
$sql_books = "SELECT * FROM `price` $where AND `active` = 1 ORDER BY `price_id` DESC LIMIT $limit $offset_str";
$books = db_get($sql_books); $books = db_get($sql_books);
if (!isset($books['error'])) { if (!isset($books['error'])) {