Need some help for creating pagination page

i need some basic pagignation code.can you guys help me

Her this should help - Page Pagination

hi guys,i am facing some problem to create a paging page.here is my page.

<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <link type="text/css" rel="stylesheet" href="path_to/simplePagination.css"/>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script type="text/javascript" src="path_to/jquery.js"></script>
  <script type="text/javascript" src="path_to/jquery.simplePagination.js"></script>
</head>
<script>
 $(function() {
    $(table).pagination({
        items: 100,
        itemsOnPage: 10,
        cssStyle: 'light-theme'
    });
})

</script>


<body>
   <ul id="pagination-demo" class>pagination></ul>
<form method="post" action="bloodbanklist.php"><a class="btn btn-info" href="bloodbankindex.php">Back</a><br><br>
<a class="btn btn-primary" href="search.php">Go for a result</a>
 </body>
 </html>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "blood_bank";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
//sql query
  $sql  = "SELECT * FROM blood_bank_db";
  $result = $conn->query($sql);

echo "<table class=table table-striped>
<tr>
<th>Id</th>
<th>Name</th>
<th>Fathername</th>
<th>Mothername</th>
<th>Address</th>
<th>Email</th>
<th>District</th>
<th>Nationality</th>
<th>B.Cirtificate No.</th>
<th>National ID</th>
<th>Mobile Number</th>
<th>Religion</th>
<th>Birthday</th>
<th>Gender</th>
<th>Blood Group</th>
<th>HBS</th>
<th>HIV</th>
<th>Maleria</th>
<th>Anemia</th>
<th>area</th>
<th>Action</th>
</tr>";

foreach($result as $row)
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['fathername'] . "</td>";
echo "<td>" . $row['mothername'] . "</td>";
echo "<td>" . $row['address'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['district'] . "</td>";
echo "<td>" . $row['nationality'] . "</td>";
echo "<td>" . $row['birthdaycirtificateno'] . "</td>";
echo "<td>" . $row['nationalid'] . "</td>";
echo "<td>" . $row['mobilenumber'] . "</td>";
echo "<td>" . $row['religion'] . "</td>";
echo "<td>" . $row['birthday'] . "</td>";
echo "<td>" . $row['gender'] . "</td>";
echo "<td>" . $row['bloodgruop'] . "</td>";
echo "<td>" . $row['hbs'] . "</td>";
echo "<td>" . $row['hiv'] . "</td>";
echo "<td>" . $row['maleria'] . "</td>";
echo "<td>" . $row['anemia'] . "</td>";
echo "<td>" . $row['area'] . "</td>";

echo "<td>" . "<a class='btn btn-warning' href='delete.php?id=$row[id]'>Delete</a>" . "<a class='btn btn-success' href='update.php?id=$row[id]'>Update</a>"."</td>";            
echo "</tr>";

}
echo "</table>";
$conn->close();	
?>
1 Like

Okay, silly question…

You have changed path_to to the actual path to those scripts?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.