Berikut adalah contoh sederhana bagaimana mendapatkan record sebelum dan sesudah. Meskipun sederhana namun ini adalah cara efektif untuk mendapatkan record sebelum dan sesudah pada database mysql kamu.
Next Record
Previous record
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'];
$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'];
Sumber: http://www.joxtechnology.com/
$qry2 = mysql_query(“select * from product where product_id < $idd order by product_id desc”);
$rr = mysql_fetch_array($qry2);
$prv= $rr['product_id'];
0 Comments
Post a Comment