csdn升级后的第一个问题,在线等待!!! 在后面的页面里加上echo "<a href=\"".$PHP_SELF."?db=".$db."&table=".$table."\"> 下一页</a>";这么做就可以了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 回 realyfly(我爱和平) 我按你的意思去做了,但显示的时候有问题了,麻烦你帮我看看下面分页的代码<html><head><title>Result</title><body bgcolor="#DBDFF1" background="rightbg.gif"><? // $dbname=sjjj; // $tablename=xhtt; // $dbname; // $tablename; mysql_pconnect("","","") or die("cann't connect the dataserver"); mysql_select_db($dbname) or die("can't connect the database 123"); function count_records($db,$table) { $result=mysql_db_query($db,"select count(*) as num from $table"); $num=mysql_result($result,0,"num"); // $data=mysql_fetch_array($result); //$num=$result["num"]; return $num; } $rowperpage=20; if(empty($page)) { $page=0; } else $page--; $least=$page*$rowperpage; echo"共收索到".$num."条信息,每一页显示20条"; $query="select * from $tablename limit $least,$rowperpage"; echo"<table border=1 width=240 height=20><tbody>"; $result=mysql_query($query); while($row_data=mysql_fetch_array($result)) { echo"<tr><td height=20 width=240>".$row_data['tname']."</td></tr><tr><td height=20 width=160><a href=$row_data->url>".$row_data['url']."</a></td></tr>"; } echo"</tbody></table>"; if($page>0) { echo"<a href='$php_self?page".($page); echo"'>前页</a>\n"; } else echo"前页"; echo"|"; $row=count_records($dbname,$tablename); if(($page+1)*$rowperpage<$row) { // echo"<a href='$php_self?page=".($page+2); echo"<a href=".$php_self."?dbname=".$dbname."&tablename=".$tablename."&page=".($page+2); echo"'>下页</a>\n"; echo"|"; } echo"<form action=$php_self? method=post>\n"; echo"<font color=green>\n"; echo($page+1)."/".(int)($row/$rowperpage+1)."page"; if($row>$rowperpage) { echo"<input type=text size=4 name=page>\n"; echo"<input type=submit value='go'>\n"; } echo"</form>\n"; ?></body></head></html> realyfly(我爱和平) 的方法不行吗?? 你的程序结构太差了吧。而且HTML和PHP没分开,看的太麻烦了。 求助!frame 的问题 急需要apache_2.0.50-win32-x86-no_ssl.msi PHP连接数据库问题 怎么给GIF格式的图片上的文字加背景颜色啊 连接数据库报错 虚拟主机php.ini里session.save_handler=files如何让session存数据库? 获得一条id的上下id的sql语句怎么写? 散分以解闷 关于复选框的提交 PHP调试的问题 请教,很使用的函数。(困扰我好久了) 高分求教:PHP+LDAP(iplanet Directory Server5.1)的问题!LDAP高手请进!!
我按你的意思去做了,但显示的时候有问题了,麻烦你帮我看看下面分页的代码
<html>
<head>
<title>Result</title>
<body bgcolor="#DBDFF1" background="rightbg.gif"><?
// $dbname=sjjj;
// $tablename=xhtt;
// $dbname;
// $tablename;
mysql_pconnect("","","") or die("cann't connect the dataserver");
mysql_select_db($dbname) or die("can't connect the database 123");
function count_records($db,$table)
{ $result=mysql_db_query($db,"select count(*) as num from $table"); $num=mysql_result($result,0,"num");
// $data=mysql_fetch_array($result);
//$num=$result["num"];
return $num;
}
$rowperpage=20;
if(empty($page))
{
$page=0;
}
else $page--;
$least=$page*$rowperpage;
echo"共收索到".$num."条信息,每一页显示20条";
$query="select * from $tablename limit $least,$rowperpage";
echo"<table border=1 width=240 height=20><tbody>";
$result=mysql_query($query);
while($row_data=mysql_fetch_array($result))
{
echo"<tr><td height=20 width=240>".$row_data['tname']."</td></tr><tr><td height=20 width=160><a href=$row_data->url>".$row_data['url']."</a></td></tr>";
}
echo"</tbody></table>"; if($page>0)
{
echo"<a href='$php_self?page".($page);
echo"'>前页</a>\n";
}
else
echo"前页";
echo"|";
$row=count_records($dbname,$tablename);
if(($page+1)*$rowperpage<$row)
{
// echo"<a href='$php_self?page=".($page+2);
echo"<a href=".$php_self."?dbname=".$dbname."&tablename=".$tablename."&page=".($page+2);
echo"'>下页</a>\n";
echo"|";
}
echo"<form action=$php_self? method=post>\n";
echo"<font color=green>\n";
echo($page+1)."/".(int)($row/$rowperpage+1)."page";
if($row>$rowperpage)
{
echo"<input type=text size=4 name=page>\n";
echo"<input type=submit value='go'>\n";
}
echo"</form>\n";
?>
</body>
</head>
</html>
而且HTML和PHP没分开,看的太麻烦了。