我想讓我的分頁工作,但即時通訊有問題,「切換」pagen不會工作,結果是不是真的工作得很好。誰能幫得到它的工作的原因我不能爲我的生命得到它的工作,我已經嘗試過這麼多:/破碎的分頁與mysql
<?
if (!(isset($pagenum)))
{
$pagenum = 1;
}
$currentpage = 20;
$data_p = mysql_query("SELECT * FROM dogs LIMIT $currentpage") or die(mysql_error());
//This is where you display your query results
while($info = mysql_fetch_array($data_p))
{
$id=$info['id'];
echo '<a href="/index.php?dogs='. $id .'">
<img src="/thumbs/'. $id .'.jpg" width="100" height="100" alt="" />
</a>';
echo "<br>";
}
echo "<p>";
// This shows the user what page they are on, and the total number of pages
echo " --Page $pagenum of $last-- <p>";
// First we check if we are on page one. If we are then we don't need a link to the previous page or the first page so we do nothing. If we aren't then we generate links to the first page, and to the previous page.
if ($pagenum == 1)
{
}
else
{
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1'> <<-First</a> ";
echo " ";
$previous = $pagenum-1;
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'> <-Previous</a> ";
}
//just a spacer
echo " ---- ";
//This does the same as above, only checking if we are on the last page, and then generating the Next and Last links
if ($pagenum == $last)
{
}
else {
$next = $pagenum+1;
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Next -></a> ";
echo " ";
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last ->></a> ";
}
?>
什麼是'$ pagenum'?這是一個'$ _GET'請求嗎? – samayo