php怎么分页显示mysql数据库中的记录?php分页时提示数据未定义改怎么解决? 5
<?php$sql=mysql_query("selectcount(*)astotalfromtb_infowheretype='公寓信息'andcheckstate=...
<?php
$sql=mysql_query("select count(*) as total from tb_info where type='公寓信息' and checkstate=1");
$info=mysql_fetch_array($sql);
$total=$info['total'];
$page = 0;
$pagesize=4;
if ($total<=$pagesize){
$pagecount=1;
}
if(($total%$pagesize)!=0){
$pagecount=intval($total/$pagesize)+1;
}else{
$pagecount=$total/$pagesize;
}
if(($_GET['page'])==""){//这里是第75行
$page=1;
}else{
$page=intval($_GET['page']);
}
$gsql=mysql_query("select * from tb_info where type='电脑信息' and checkstate=1 order by edate desc limit ".($page-1)*$pagesize.",$pagesize");
$ginfo=mysql_fetch_array($gsql);
if($ginfo){
do{
?>
错误提示:
Notice: Undefined index: page in D:\xampp\htdocs\Computer\main.php
on line 75 展开
$sql=mysql_query("select count(*) as total from tb_info where type='公寓信息' and checkstate=1");
$info=mysql_fetch_array($sql);
$total=$info['total'];
$page = 0;
$pagesize=4;
if ($total<=$pagesize){
$pagecount=1;
}
if(($total%$pagesize)!=0){
$pagecount=intval($total/$pagesize)+1;
}else{
$pagecount=$total/$pagesize;
}
if(($_GET['page'])==""){//这里是第75行
$page=1;
}else{
$page=intval($_GET['page']);
}
$gsql=mysql_query("select * from tb_info where type='电脑信息' and checkstate=1 order by edate desc limit ".($page-1)*$pagesize.",$pagesize");
$ginfo=mysql_fetch_array($gsql);
if($ginfo){
do{
?>
错误提示:
Notice: Undefined index: page in D:\xampp\htdocs\Computer\main.php
on line 75 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询