欢迎光临第一亲子网

一个PHP+MSSQL分页的例子

2013-9-3 | 来源:第一亲子网 | 点击:

导读: ...

require "config.PHP";
dl("extensions/PHP_mssql70.dll");
if (!isset($page)) { $page=1; }
if ($page<=0) { $page=1; }
牋牋$db=mssql_connect($local,$user,$pass);
牋牋爉ssql_select_db($name,$db);
牋牋$query=mssql_query("select count(*) as date from news",$db);
牋牋$query=mssql_fetch_array($query);
牋牋$pages=ceil($query[0]/$userperpage);
牋牋牋if ($page>$pages) { $page=$pages;}
牋牋牋if ($query[0]<$userperpage) { $userperpage=$query[0]; }
$dangqian=($page-1)*$userperpage;
echo "News";
echo " ";
echo "
";
echo " echo "";
echo " ";
echo "";
echo "牋牋 ";
echo "牋牋 ";
echo "牋牋 ";
echo "牋牋 ";
echo "牋牋 ";
echo "牋 ";
echo "

echo "牋牋color=#408080>新闻标题

echo "牋牋color=#408080>发表日期 echo "牋牋color=#408080>发表部门 echo "牋牋color=#408080>阅读 echo "牋牋color=#408080>图像
";
echo "
";
echo "