Burada benim sayfa ile sorun yaşıyorum:
Masanın benim "rütbe" bölümü, sayfa 2 ve ötesinde tıkladığınızda sıfıra geri sıfırlama tutar. Bu 21 de başlamazsa, sadece geri sıfıra sıfırlar.
Bunu nasıl düzeltebilirim?
<?php
include ("database.php");
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * 20;
$sql = ("SELECT * FROM voting ORDER BY votepoints DESC LIMIT $start_from, 20") or die ("Error 1.");
$rs_result = mysql_query ($sql) or die (include ("error.html"));
$rank = 1;
?>
<table>
<tr><td>Rank</td><td></td><td>Username</td><td></td><td></td><td></td><td>Vote points</td></tr>
<?php
while ($row = mysql_fetch_assoc($rs_result)) {
?>
<tr>
<td><? echo $rank++; ?></td>
<td></td>
<td><? echo $row["username"]; ?></td>
<td></td>
<td></td>
<td></td>
<td><? echo $row["votepoints"]; ?></td>
</tr>
<?php
};
?>
</table>
<?php
echo '<br>';
echo 'Total Votes: ';
include ("sum.php");
include("database.php");
$sql = "SELECT COUNT(votepoints) FROM voting";
$rs_result = mysql_query($sql);
$row = mysql_fetch_row($rs_result);
$total_records = $row[0];
$total_pages = ceil($total_records / 20);
echo '<span class="text-bleumarin">';
if($page>1)
$pagelink ='<a href="votes.php?page='.($page-1).'">prev</a> ';
echo $pagelink;
for ($i=1; $i<=$total_pages; $i++) {
if ($i != $page)
echo "<a href='votes.php?page=".$i."'>".$i."</a> ";
if ($i==$page)
echo '' . $i . ' ';
};
if($page<$total_pages)
$pagelink ='<a href="votes.php?page='.($page+1).'">next</a> ';
echo $pagelink;
echo '</span>';
?>