A php + MSSQL paging example .? Requireconfig. php; dl (extensionsphp_mssql70.dll); if (! Isset ($ page) {$ page1;} if ($ page0) {$ page1;} $ dbmssql_connect ($ local, $ user, $ pass); mssql_select_db ($ name, $ db); $ q 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" News";
Echo" \ N ";
Echo"
\ N ";
Echo"
Echo"
";Echo"
|
\ N ";Echo"
";Echo"
Echo "color = #408080> News title | \ N ";Echo"
Echo "color = #408080> posting date | \ N ";Echo"
Echo "color = #408080> Publish a department | \ N ";Echo"
Echo "color = #408080> Read | \ N ";Echo"
Echo "color = #408080> image | \ N ";Echo"
\ N ";Echo"
\ N ";
Echo"
\ N ";
Echo"
\ N ";
Echo"
Currently, there are no records 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 "homepage \ n "; } If ($ page> 1 ){ $ Upage = $ page-1; Echo "previous page \ 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 Page \ n "; } Echo" | \ N ";Echo"
\ N ";Echo"
\ N ";
Echo"
\ N ";
?>
Http://www.bkjia.com/PHPjc/315963.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/315963.htmlTechArticle? 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); $ q...