I'm trying to create a pagination system, but there is a problem. I created this page by following a youtube tutorial. The page shown in tutorial works well, but when I write the code for my page, it give me an error. Here is the code.
Pagination system error
4
I'm trying to create a pagination system, but there is a problem. I created this page by following a youtube tutorial. The page shown in tutorial works well, but when I write the code for my page, it give me an error.
Here is the code.
And here is the URL to my test website where you can see the error. The website doesn't work.
Please help me to solve this problem.
Here is the code.
Code:
<?php
$perPage = 5;
if (!isset($_GET['submit'])) {
header("location: index.php?page=1");
}
else {
$page = $_GET['submit']; }
$start = (($page - 1) * $perPage);
$con = mysqli_connect("mysql5.000webhost.com", "a8995753_db2", "xxxxxxxxx", "a8995753_db2") or die("Error ee oay: " . mysqli_connect_error());
$query = "SELECT * FROM customer";
$numOfRows = mysqli_num_rows(mysqli_query($con, $query));
$numOfPages = ceil($numOfRows / $perPage);
$query .= " LIMIT $start, $perPage";
$exQuery = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($exQuery)) {
echo $row['custID'] . " " . $row['name'] . "<br>";
}
?> Please help me to solve this problem.
- Brian Tayler
- Valdor Kiebach
- crescendo
Next Topics on Trending Feed
-
4