Below is a code for my pagination. The problem that I am having is that the page count is displayed correctly but when I click on page 2 onwards I just get a blank page.
<?php
if (isset($_POST['edit'])) {
if (empty($_GET['page'])) {
$page=0;
}
else {$page = (int)$_GET['page'];}
if ($page == 0){ $page = 1;}
if (ob_get_level() == 0) ob_start();
$per_page = 10;
$p = ($page - 1) * $per_page;
$sql="select * from tba where word='$word' order by id DESC limit ".$p.",".$per_page;
$result=mysql_query($sql) or die(mysql_error());
while ($row=mysql_fetch_array($result)) {
$id=$row['id'];
$word=$row['word'];
$pr=$row['pr'];
if ($pr==0) {
}
else {
?>
<td><span class="style5"><?php echo $id; ?> </span></td>
<td><span class="style5"><?php echo $word?></span></td>
<?php
}
$pages = floor($total / $per_page) + ($total%$per_page>0?1:0);
?>
<center>
<?php
}
for ($i=1;$i<=$pages;$i++) {
print "<a href='?page=".$i."'>".$i."</a> ";
}
echo "<br>You are in page ".$_GET['page'];
}
can some one please tell me what the problem is?