Been trying to work out how to do this for hours, i have managed to get queries using OFFSET and FETCH which will set the amount of results to display and at which number to start at but cant seem to work out how to actually use my pagination in my footer so it display on a new page.
very new to html, css, php and mysql so its a learn as you go but hard to find tutorials that make sense.
<?php
$sql = "SELECT STEAM_ID, Hunters, Smoker, Boomers, Spitters, Jockeys, Charger,
(Hunters + Smoker + Boomers + Spitters + Jockeys + Charger) as Total_Kills
FROM Special_Infected_Kills ORDER BY Total_Kills DESC";
$result = $conn->query($sql);
if ($result = $conn->query($sql)) {
echo "<table><tr>
<th>Player</th>
<th>Total Kills</th>
<th>Hunter</th>
<th>Jockey</th>
<th>Charger</th>
<th>Smoker</th>
<th>Boomer</th>
<th>Spitter</th>
</tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr>
<td>".$row["STEAM_ID"]."</td>
<td>".$row["Total_Kills"]."</td>
<td>".$row["Hunters"]."</td>
<td>".$row["Boomers"]."</td>
<td>".$row["Spitters"]."</td>
<td>".$row["Jockeys"]."</td>
<td>".$row["Charger"]."</td>
<td>".$row["Smoker"]."</td>
</tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>
MY FOOTER
<footer>
<div class="center">
<div class="pagination">
<a href="#">«</a>
<a href="#" class="active">1</a>
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>
<a href="#">5</a>
<a href="#">6</a>
<a href="#">»</a>
</div>
</div>
<div class="createdby">
<p> Website built & designed by Blade </p>
</div>
</footer>
So pretty much just want the first 20 results on the first page then every 20 after that on another page by clicking the pagination in the footer