I am fairly new to programming, and this site was recommended to me by a friend. I created a table for my inventory and I want to add pagination to this table. How can I do this? I appreciate the help, and thanks in advance!
<?php include ("Connection.php"); ?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="Design.css">
<script type=" text/javascript">
function deleteRecord(id) {
if (confirm("Are you sure you want to delete this record?")) {
window.location.replace("delete.php?id=" +id);
}
}
</script>
</head>
<body>
<?php
$qry = $con->prepare("SELECT * FROM tableinvplastic");
$qry->execute();
$rows = $qry->fetchAll(PDO::FETCH_ASSOC);
?>
<table>
<th><center>ID</center></th>
<th><center>Item Name</center></th>
<th><center>Brand</center></th>
<th><center>Initial Price</center></th>
<th><center>Sales Price</center></th>
<th><center>Quantity</center></th>
<th><center>Dealer</center></th>
<th><center>Edit</center></th>
<th><center>Delete</center></th>
<th><center>Add</center></th>
<th><center>Minus</center></th>
<?php
foreach($rows as $row) {
print "<tr>";
print "<td>" .$row['ID']. "</td>";
print "<td>" .$row['ItemName']. "</td>";
print "<td>" .$row['Brand']. "</td>";
print "<td>" .$row['InitialPrice']. "</td>";
print "<td>" .$row['SalesPrice']. "</td>";
print "<td>" .$row["Quantity"]. "</td>";
print "<td>" .$row["Dealer"]. "</td>";
print "<td><a href='UpdatePlastic.php?id=" .$row["ID"]. "'>Edit</a></td>";
print "<td><a href='#!' onclick = 'deleteRecord(" .$row["ID"]. ");'>Delete</a></td>";
print "<td><a href='Add.php?id=" .$row["ID"]. "'>Add</a></td>";
print "<td><a href='Minus.php?id=" .$row["ID"]. "'>Minus</a></td>";
print "</tr>";
}
?>
</table>
<style>
table {
width: 60%;
position: absolute;
top: 200px;
left: 100px;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th {
padding: 5px;
text-align: left;
background-color: #4CAF50;
}
</style>
</body>
</html>