Answer the question
In order to leave comments, you need to log in
How to fix "A non-numeric value encountered" error?
When displaying news on the page, it swears at this code, or rather at the line:
return $this->conn->query("SELECT * FROM `news` ORDER BY `created_at` DESC LIMIT ".abs($page*$per_page).",".$per_page." ")->fetch_assoc_array();
public function getListNews($page,$per_page = 3){
global $func;
$page = $func->clearQuery($this->conn,$page-1);
return $this->conn->query("SELECT * FROM `news` ORDER BY `created_at` DESC LIMIT ".abs($page*$per_page).",".$per_page." ")->fetch_assoc_array();
}
$page = 1;
if(isset($_GET["page"])) $page = (int)$_GET["page"];
$list = $news->getListNews($page, 9);
$count = intval(($news->getCountNews() - 1) / 9) + 1;
if(count($list) == 0){
$page = $count;
$list = $news->getListNews($page, 9);
if(count($list) == 0){
$out = "Новости не найдены!";
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question