Jox Technology

Online resource of games, gadgetm and web development

Advertisement

Here’s a simple but effective way to get the next or previous record on your mysql database.

Next Record
$idd = 10; // supposed this is the current/selected record
$qry2 = mysql_query(”select * from product where product_id > $idd order by product_id asc”);
$rr = mysql_fetch_array($qry2);
$nxt= $rr['product_id'];

Previous record

$idd = 10; // supposed that this is the current/selected record
$qry2 = mysql_query(”select * from product where product_id < $idd order by product_id desc”);
$rr = mysql_fetch_array($qry2);
$prv= $rr['product_id'];

Comments

There are no comments for this post.

Comments are closed.

Write a Comment