作者:FrxxGp | 来源:互联网 | 2018-07-16 17:13
ec(2);$scriptnamesplit([],$_SERVER[SCRIPT_NAME]);$filenameend($scriptname);$MM_Conn_STRING"DRIVER{MicrosoftAccessDriver(*.mdb)};DBQ".realpath("www.111cn.neta.
$scriptname = split('[/]',$_SERVER['SCRIPT_NAME']);
$filename = end($scriptname);
$MM_Conn_STRING="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("www.111cn.net/a.mdb") ." ;DefaultDir=". realpath(".");
$COnn=new COM("ADODB.Connection");
$RS =new COM("ADODB.RecordSet");//数据集
$Conn->open($MM_Conn_STRING);//链接打开数据源
$query="select * from doubt";
$RS->open($query,$Conn,1,1);//执行语句,返回记录集
$pagesize=$RS->Pagesize=3;//设置每页显示条数
if($RS->PageCount<>0){//防止数据库教程为空
if(!empty($_GET['page'])){
if($_GET['page']<=0){
$RS->AbsolutePage=1;
$nowpage=1;
}elseif($_GET['page']>$RS->PageCount){
$RS->AbsolutePage=$RS->PageCount;
$nowpage=$RS->PageCount;
}else{
$RS->AbsolutePage=$_GET['page'];
$nowpage=$_GET['page'];
}
}else{
$RS->AbsolutePage=1;
$nowpage=1;
}
}else{
$nowpage = 1;
$pagesize = 0;
}
echo "当前显示第".$nowpage."页 ";
echo "每页".$pagesize.'条 ';
echo "共有".$RS->RecordCount."条记录 ";
echo "共有".$RS->PageCount."页
";
for ($m=1; $m<=$pagesize; $m++)
{
echo "
姓名:".$RS->fields["username"]->value." |
问:".$RS->fields["biaoti"]->value." |
".$RS->fields["wendate"]->value." |
问题:".$RS->fields["neirong"]->value."
回复 |
";
$RS->MoveNext();
//if($RS->PageCount==0){
//echo "没有数据";
}
if($RS->PageCount<>0){//防止数据库为空
echo "首页 ";
if (!($nowpage<=1)){
echo "上一页 ";
}
if (!($nowpage>=$RS->PageCount)){
echo "下一页 ";
}
echo "PageCount.">尾页 ";
}
//释放资源
$Conn->Close();
$RS=NULL;
$COnn=NULL;