Require "config.php";
DL ("Extensions/php_mssql70.dll");
if (!isset ($page)) {$page = 1;}
if ($page <=0) {$page = 1;}
$db =mssql_connect ($local, $user, $pass);
mssql_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 " <title>News</title>";
echo " \ n ";
echo " \ n ";
echo "
echo "
"; echo "
|
\ n "; echo "
"; echo "
echo "color= #408080 > news Headlines | \ n "; echo "
echo "color= #408080 > Publication date | \ n "; echo "
echo "color= #408080 > Publishing Department | \ n "; echo "
echo "color= #408080 > Reading | \ n "; echo "
echo "Color= #408080 > Images | \ n "; echo "
\ n "; echo "
\ n ";
echo " \ n ";
echo " \ n ";
echo "
There is no record in the database!
\ n ";$db =mssql_connect ($local, $user, $pass);mssql_select_db ($name, $db);$query =mssql_query ("SELECT * from News ORDER BY date Desc", $db);$roro =mssql_num_rows ($query);if ($roro ==0) {echo "";Exit}Mssql_data_seek ($query, $dangqian);$i = 0;while ($arr =mssql_fetch_array ($query)) {if ($i >= $userperpage) {break;}echo "
\ n "; echo "
$arr [title] | \ n "; $datee =date ("y-m-d", $arr [Date]); echo "
$datee | \ n "; echo "
$arr [Type] | \ n "; echo "
$arr [click] | \ n "; echo "
\ n "; $arr [Photo]=trim ($arr [photo]); if ($arr [photo]<> "") | | (File_exists ($arr [photo])) { echo ""; } else {echo "";} echo " | \ n "; echo "
\ n ";$i + +;}//whileecho "
\ n "; echo "
| \ n "; echo "
\ n ";echo "
\ n "; if ($page <>1) { echo "Home \ n"; } if ($page >1) { $upage = $page-1; echo "prev \ n"; } for ($y =1; $y <= $pages; $y + +) { echo "$y \ n"; } if ($page < $pages) { $npage = $page +1; echo "next page \ n"; } if ($page <> $pages) { echo "last \ n"; } echo " | \ n "; echo "
\ n ";echo "
\ n ";
echo " \ n ";
?>
The above describes an example of SQL Query Analyzer Php+mssql paging, including the contents of SQL Query Analyzer, I hope to be interested in PHP tutorial friends helpful.