第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

我怎么顯示的0頁,

<?php

header('Content-type:text/html;charset=utf-8');

$page=$_GET['p'];

$host='localhost';

$user='root';

$password='';

$db='msg';

$pageSize=10;

$conn=mysql_connect($host,$user,$password);


if(!$conn){

echo "連接數(shù)據(jù)庫失敗";

}

mysql_select_db($db);

mysql_query('set names utf8');

$querysql="select*from mypage limit ".(($page-1)*10).",10";

if(!$querysql){

echo "數(shù)據(jù)庫中沒有數(shù)據(jù)";

}

$result=mysql_query($querysql);

echo "<table border=1 cellspacing=0 width=30%>";

echo "<tr><td>ID</td><td>NAME</td></tr>";

while($row=mysql_fetch_assoc($result)){

echo "<tr>";

echo "<td>{$row['id']}</td>";

echo "<td>{$row['name']}</td>";

echo "</tr>";

}

echo "</table>";

//釋放結(jié)果

mysql_free_result($result);

//獲取數(shù)據(jù)總數(shù)

$total_sql="select count(*) from mypage";

$total_result=mysql_query($total_sql);

$total=$total_result[0];

//計(jì)算頁數(shù)

$total_pages=ceil($total/10);


//顯示分頁+分頁條

$page_banner="<a href='".$_SERVER['PHP_SELF']."?p=".($page-1)."'>上一頁</a>";

$page_banner.="<a href='".$_SERVER['PHP_SELF']."?p=".($page+1)."'>下一頁</a>";

$page_banner.="共".$total_pages."頁";

echo $page_banner;

?>


正在回答

2 回答

數(shù)據(jù)庫得有數(shù)據(jù)才行,先輸出總條數(shù)看看有數(shù)據(jù)沒

0 回復(fù) 有任何疑惑可以回復(fù)我~

就是總頁數(shù)為0,導(dǎo)致后面的做不了。誰幫我找找問題

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

我怎么顯示的0頁,

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)