При переходе на новые страницу(1.2.3.4..5) "Запрашиваемый ресурс не найден."
<?php
require_once("db.php");
if($connection == false){
echo "Error!";
echo mysqli_connect_errno();
exit();
}
if (isset($_GET['page'])){
$page = $_GET['page'];
} else {
$page = 1;
}
$limit = 8;
$number = ($page * $limit) - $limit;
$res_count = mysqli_query($connection, "SELECT COUNT(*) FROM `$dbarticles` ");
$row = mysqli_fetch_row($res_count);
$total = $row[0];
$str_pag = ceil($total / $limit);
$query = mysqli_query($connection, "SELECT * FROM $dbarticles ORDER BY id DESC LIMIT $number, $limit ");
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Документ без названия</title>
</head>
<style>
.art{border: 1px solid #787777;
width: 800px;
}
</style>
<body>
<?php
for ($i = 1; $i <=$str_pag; $i++){
echo " <a href=index.php?page=".$i.">".$i."</a> ";
}
if(mysqli_num_rows($query) == 0){
echo "There are no records!";
} else {
while($article = mysqli_fetch_assoc($query)){
echo '<div class="art">';
echo '( '.$article['id'].' ) <a href=page.php?id='.$article['id'].'>'.$article['title'].'</a><br>';
echo $article['text'].'<br>';
echo '</div>';
}
}
?>
</body>
</html>