Example of a PHP + MSSQL paging _ PHP Tutorial

Source: Internet
Author: User
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" \ N ";Echo" \ N ";Echo" \ N ";Echo" \ N ";Echo" \ N ";Echo" \ N ";Echo"

Echo "color = #408080> News title

Echo "color = #408080> posting dateEcho "color = #408080> Publish a departmentEcho "color = #408080> ReadEcho "color = #408080> image
\ 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" \ N ";$ Datee = date ("Y-m-d", $ arr [date]);Echo" \ N ";Echo" \ N ";Echo" \ N ";Echo" \ N ";Echo" \ N ";$ I ++;} // WhileEcho" \ N ";Echo" \ N ";Echo" \ N ";Echo" \ N ";Echo" \ N ";Echo"

$ Arr [title]

$ Datee$ Arr [type]$ Arr [click]\ N ";
$ Arr [photo] = trim ($ arr [photo]);
If ($ arr [photo] <> "") | (file_exists ($ arr [photo]) {
Echo "";
}
Else {echo "";}
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 ";
?>

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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.