PHP MSSQL Page Instance (refresh), MSSQL paging
/*
' Page description:
*/
$link =mssql_connect ("MYSQL2005", "sa", "123456") or Die ("DB link error!". Mssql_error ());
mssql_select_db ("Edu_dzk", $link) or Die ("db Open error!". Mssql_error ());
Mssql_query ("Set names ' UTF8 '");
$sqlstrcount = "SELECT count (1) from Reguser";
$page = $_get["page"];
if (!is_numeric ($page)) {
$page = "1";
}
$pagesize = "30";
$sql =mysql_query ($SQLSTR);
$totalnum =mysql_num_rows ($sql);
$sql =mssql_query ($sqlstrcount);
List ($totalnum) =mssql_fetch_row ($sql);
$pagecount =ceil ($totalnum/$pagesize);
$offset = ($page-1) * $pagesize;
$SQLSTR = "SELECT Top". ($pagesize). " * FROM Reguser where ID isn't in (select top.) ($page-1) * $pagesize). "ID from Reguser ORDER BY id DESC", ORDER by id DESC ";
$sql =mssql_query ($SQLSTR);
$result = "";
while ($result =mssql_fetch_array ($sql)) {
echo $result ["id"]. '
';
}
Showpageinfo2 ($totalnum, $pagecount, $page, "&z=". $z);
Mssql_close ($link);
function Showpageinfo2 ($totalnum, $pagecount, $page, $filster)
{
echo "Total: $totalnum records, a total of $pagecount page, is currently the first $page page";
if ($page!=1)
{
echo "Home";
echo "Prev";
}
if ($page < $pagecount)
{
echo "Next page";
echo "Last";
}
}
?>
http://www.bkjia.com/PHPjc/1119218.html www.bkjia.com true http://www.bkjia.com/PHPjc/1119218.html techarticle PHP MSSQL Paging instance (refresh), MSSQL paging? PHP/* page Description: */$link =mssql_connect ("MYSQL2005", "sa", "123456") or Die ("DB link error!". Mssql_error ()); mssql_select_db ("Edu ...