How to move next and previous record in php mysql on click link hyperlinks

Description

How to move next and previous record in php mysql on click link hyperlinks, Onclick link hyperlinks go to next page content in php mysql, Go to next post in php mysql on click link hyperlinks and fetch mysql record content according to id and show mysql fetch record

Used in show and fetch content on click and show next mysql record post content in php mysql

<?php

/* Put mysql connection code here */

 

//$id=$_GET['id'];

//$id = $currentid;

 

$currentid = $_GET['id'];

echo "SELECT * FROM oflinetestresult WHERE id = $currentid ORDER BY id DESC LIMIT 1"; 

$prevquery= "SELECT * FROM oflinetestresult WHERE id = $currentid ORDER BY id DESC LIMIT 1"; 

$prevresult = mysql_query($prevquery) or die(mysql_error());

while($prevrow = mysql_fetch_array($prevresult))

{

$previdl  = $prevrow['id'];  

echo "<br>";

echo $previdl;

$previdc1  = $prevrow['adminno']; 

echo "<br>";

echo $previdc1;

echo "<br>";

}

 

$prevquery= "SELECT * FROM oflinetestresult WHERE id < $currentid ORDER BY id DESC LIMIT 1"; 

$prevresult = mysql_query($prevquery) or die(mysql_error());

while($prevrow = mysql_fetch_array($prevresult))

{

$previd  = $prevrow['id'];

echo $previd;

echo "list1";

echo "<br>";

}

 

$nextquery= "SELECT * FROM oflinetestresult WHERE id > $currentid ORDER BY id ASC LIMIT 1"; 

$nextresult = mysql_query($nextquery) or die(mysql_error());

while($nextrow = mysql_fetch_array($nextresult))

{

$nextid  = $nextrow['id'];

//echo $nextid;

echo "list2";

echo "<br>";

}

?>

 

<a href="http://localhost/3dropdownmenu/timetable/studentloginteacherbatchtrack.php?id=<?php echo $previd; ?>">Previous</a>

 

<a href="http://localhost/3dropdownmenu/timetable/studentloginteacherbatchtrack.php?id=<?php echo $nextid; ?>">Next</a>