In the code given below i am calling get.php?id=inc every time button is clicked Using Ajax. I want that when every time this get.php is called select query fetch next record in table.
JavaScript File:
xmlhttp.open("GET","get.php?id=inc",true);
xmlhttp.send();
get.php File:
<?php
if(isset($_GET['nextq'])){ //nextq the name of button
$idd= $_GET['id'];
include 'library/php/connect.php';
$q = "SELECT * from hp_questions where id=$idd";
$q = mysqli_query($conn, $q);
while ($row = mysqli_fetch_array($q)){
echo
$row['question'];
}
?>