作者:手机用户2702935421_666 | 来源:互联网 | 2018-07-17 02:43
php数据分页加数据显示效果
include_once(dirname(__FILE__).'../../Inc/Conn.php');
include_once(dirname(__FILE__).'../../photo/Inc/function.php');
?>
导出Execel表格
帐号 |
邮箱 |
性别 |
宝宝出生日期 |
省份 |
真实姓名 |
邮编 |
手机 |
地址 |
$sql ="Select * from tablename";
$result =mysql_query($sql) or die('fail1'.mysql_error());
$rs =mysql_fetch_array($result);
$rdcount =mysql_num_rows($result);
if($rdcount){
$pagesize =20;
$pagecount=($rdcount % $pagesize)?(int)($rdcount / $pagesize)+1:$rdcount/$pagesize;//统计总页面
$page =isset($_GET['page'])?$_GET['page']:1;//取得当前页面
$start =($page>=1 && $page<=$pagecount)?$start=$pagesize*($page-1):$start=1;//取得超始记录
$start =$start;
$sql =$sql." order by add_date desc limit $start,$pagesize";
$result =mysql_query($sql) or die(mysql_error());
while($rs =mysql_fetch_array($result) ){
echo"
".$rs['User_Name']." |
".$rs['User_Mail']." |
".$rs['User_Baby_Sex']." |
".$rs['User_Baby_Birth']." |
".$rs['sheng']." |
".$rs['User_rname']." |
".$rs['User_Zip']." |
".$rs['User_Hand']." |
".$rs['User_Address']." |
";
}
echo " ";
pagelist1($page,$pagecount,$rdcount,'?page=',$pagesize);
echo " |
";
}else{
echo '暂时没有信息!';
}
function pagelist1($page,$pagecount,$totalrecord,$url,$pagesize)
{
if($page=="" || $page>$pagecount)
{
$page=1;
}
echo("记录".$totalrecord."条 每页".$pagesize."条 共".$pagecount."页 << ");
if($page>1)
{
echo(" < ");
}
if($page+9>$pagecount)
{
$current = $pagecount;
}
else
{
$current = $page+9;
}
for($i=$page;$i<=$current;$i++)
{
echo("$i ");
}
if($pagecount>$page)
{
echo(" > ");
}
echo(" >> ");
}
?>