So I have a database, with a table in it. In the table, there's only one "ID" field
ID
1
2
3
..
what I want to do is to display the ID individually on my page, starting from ID=1. and when I click a button, the next ID will be displayed (ID=2, ID=3, .. each button click)
So this is my code
<?php
...
$id = (isset($_GET['id']) ? intval($_GET['id']) : 1);
$result = $db->query("SELECT * FROM id_table WHERE id>='$id' ORDER BY id ASC limit 2 ");
$row = $result->fetch_assoc();
...
<form action="" method="POST">
<h1 class="mb-3">
<?php echo($row['id'])?>
</h1>
<button onclick="" class="btn btn-primary btn-xl">Next</button>
</form>
ID is successfully displayed. But I've been struggling to make a working next button.
If this is a bad coding, please let me know and point me in right direction, so I can fix my mistakes. Thank you in advance, have a great day!