table翻页问题 本帖最后由 miehunyou 于 2011-05-20 15:18:06 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $sql="select * from book"; $arr=$db->execute($sql); $rows=count($arr); if($rows%5==0){ $pages=$rows/5; }else{ $pages=(int)($pages/5)+1; } @$currentPage=$_GET['currentPage']; if(!isset($currentPage) || $currentPage<1){ $currentPage=1; } if($currentPage>$pages && $pages!=0){ $currentPage=$pages; } $sql="select * from book limit ".(($currentPage-1)*5).",5"; $arr=$db->execute($sql);看看这个 可以帮助你不, 我不太会用呢...我才学php一个礼拜...这些让我其他资料都不见了,剩下个table... <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()."<br>"); }mysql_select_db("bg_db", $con);$result = mysql_query("SELECT * FROM Persons ORDER BY GuestId desc limit 5",$con);echo "<table border='1'><tr><th>No.</th><th width='98%'>Guest</th></tr>";while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . ++$no . ".</td>"; echo "<td>Name : " . $row['Name'] . "<br>Email : " . $row['Email'] . "<br>Country : " . $row['Country'] . "<br><br>" . $row['Comment'] . "</td>"; echo "</tr>"; }echo "</table>";?>我暂时把一面限制成五项了,要怎么翻页= = php向客户端传送文件被中止 心情很烦躁。。。。 PHP学习书籍 PHP 5.3.0 如何屏蔽错误提示? Phpmyadmin问题 关于php拥有root权限的问题 用Frontpage 管理 网站 在线等待,关于oracle的问题,解决问题马上给分!!!!!!!!!!!!!!!! 请问Windows版本的php是否支持数据抽象层(DBA)函数? php,FTP上传文件及文件夹 linux服务器中,php页面中信号量锁住的问题,在线等 PHP链接MYSQL出现问题
$arr=$db->execute($sql);
$rows=count($arr);
if($rows%5==0){
$pages=$rows/5;
}else{
$pages=(int)($pages/5)+1;
}
@$currentPage=$_GET['currentPage'];
if(!isset($currentPage) || $currentPage<1){
$currentPage=1;
}
if($currentPage>$pages && $pages!=0){
$currentPage=$pages;
}
$sql="select * from book limit ".(($currentPage-1)*5).",5";
$arr=$db->execute($sql);看看这个 可以帮助你不,
这些让我其他资料都不见了,剩下个table...
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error()."<br>");
}
mysql_select_db("bg_db", $con);
$result = mysql_query("SELECT * FROM Persons ORDER BY GuestId desc limit 5",$con);echo "<table border='1'>
<tr>
<th>No.</th>
<th width='98%'>Guest</th>
</tr>";while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . ++$no . ".</td>";
echo "<td>Name : " . $row['Name'] .
"<br>Email : " . $row['Email'] .
"<br>Country : " . $row['Country'] .
"<br><br>" . $row['Comment'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
我暂时把一面限制成五项了,要怎么翻页= =