If u want to navigate record without passing id array or other value sting following code will help u to move forward and backword on basis of present display id.
<div>
<?php
$selPre="select id from table where id<$imgId and status='Yes' order by id Desc";
$preRs=mysql_query($selPre,$dbc)or die('error in previous id : '.mysql_error());
$preId=mysql_fetch_array($preRs);
if(mysql_num_rows($preRs)>0){
?>
<a title="Previous" href="Selffilename.php?Id=<?php echo $preId["id"];?>" class="no-underline">
<span style="color: rgb(105, 105, 105); font-weight: bold;">PREVIOUS</span>
<span class="paginate-first"><<</span>
</a>
</div>
<div align="right" style="width:50%; float:left">
<?php
}
$selNxt="select id from table where id>$Id and status='Yes' order by id ASC";
$NxtRs=mysql_query($selNxt,$dbc)or die('error in previous id : '.mysql_error());
$nxtId=mysql_fetch_array($NxtRs);
if(mysql_num_rows($NxtRs)>0){
?>
<a title="Last Page" href="Selffilename.php?Id=<?php echo $nxtId["id"];?>" class="no-underline">
<span class="paginate-last">>></span>
<span style="color: rgb(105, 105, 105); font-weight: bold;">NEXT</span>
</a>
<?php
}?>
No comments:
Post a Comment