Hi im new for the PHP. In my project having account page in that page im using while loop for retrieving the data user values.here i should show 3 values and if user clicks pagination next button then it should show next three values in same page..and if user clicks again next button and i should show next next three values...here the condition is i should show only three values per page...
<?php
$r12 = mysql_query("SELECT COUNT(*) FROM Op where Active=1 and UserID=".$uid);
$r = mysql_fetch_row($r12);
$numrows = $r[0];
$rowsperpage = 1;
// find out total pages
$totalpages = ceil($numrows / $rowsperpage);
// get the current page or set a default
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
// cast var as int
$currentpage = (int) $_GET['currentpage'];
} else {
// default page num
$currentpage = 1;
} // end if
// if current page is greater than total pages...
if ($currentpage > $totalpages) {
// set current page to last page
$currentpage = $totalpages;
} // end if
// if current page is less than first page...
if ($currentpage < 1) {
// set current page to first page
$currentpage = 1;
} // end if
// the offset of the list, based on current page
$offset = ($currentpage - 1) * $rowsperpage;
?>
<?php
$i=1; $j=0;
$sql = mysql_query("SELECT * from Op where UserID=".$uid." and Active=1 order by TimeStamp desc");
$num_rows=mysql_num_rows($sql);
if($num_rows > 0)
{
while($d=mysql_fetch_array($sql))
{
if($i==1)
{
echo "<div class='mainScroller listingPage'>";
}
?>
<div class="itemCell itemCellFix itemListing">
<div class="imgItem">
<a href="itemDetails.php?ID=<?php echo $d['O']; ?>"></a>
</div>
<h4 class="spacer"><?php $sub=$d['Sb']; ?></h4>
<span class="listQ">
Location
</span>
<span class="listA"><?php $v2=$data["Loc"];?></span>
<?php
$j++;
if($i%1==0)
{
echo "</div>";
$i=1;
continue;
}
$i++;
} if($numrows%1!=0)
{
echo "</div>";
echo"qwe";
} ?>


