Answer the question
In order to leave comments, you need to log in
Why does pagination work incorrectly when filtering?
Hello, I'm looking for advice and help.
I have a page where I retrieve information from a database.
And since there is a lot of information, you need to make pagination. In order not to write a bicycle, I found a pagination class on a good site. here
and use it. There was a problem:
When loading the page, everything works fine:
// пагинация
include($dr.'/pagination/pagination.php');
$peger = new DBPaginator($url2, 6); // 6 - колво выводов на странице
$items = $peger->getItems("SELECT * FROM `apple` ORDER BY `id` DESC");
foreach ($items as $item){
...
}
// пагинация
include($dr.'/pagination/pagination.php');
$peger = new DBPaginator($urlForPagi, 6); // 6 - колво выводов на странице
$items = $peger->getItems("SELECT * FROM `apple ` WHERE `color` = $_POST['color'] ORDER BY id DESC");
Answer the question
In order to leave comments, you need to log in
one)
WHERE `color` = $_POST['color']In general, a hole, at least some kind of check, I am silent about prepared expressions that are a must-have like that ...
I'm not a PHP person, but as a variant .
I can assume that it is necessary to add code to the page so that the request is saved in the link)))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question