Php mssql paging instance and phpmssql paging instance

Source: Internet
Author: User

Php mssql paging instance and phpmssql paging instance

The examples in this article share with you the following details about php mssql refresh paging instances:

<? Php/* '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 not in (select top ". ($ page-1) * $ pagesize ). "id from reguser order by id desc) order by id desc"; $ sq L = mssql_query ($ sqlstr); $ result = ""; while ($ result = mssql_fetch_array ($ SQL) {echo $ result ["id"]. '<br>';} showpageinfo2 ($ totalnum, $ pagecount, $ page, "& z = ". $ z); mssql_Close ($ link); function showpageinfo2 ($ totalnum, $ pagecount, $ page, $ filster) {echo "Total: $ totalnum records, total $ pagecount page, current is the $ page "; if ($ page! = 1) {echo "<a href =? Page = 1 $ filster> homepage </a> "; echo" <a href =? Page = ". ($ page-1)." $ filster> previous page </a> ";} if ($ page <$ pagecount) {echo" <a href =? Page = ". ($ page + 1)." $ filster> next page </a> "; echo" <a href =? Page = $ pagecount $ filster> last page </a> ";}}?>

The following is a general paging formula for PHP + MSSQL for your reference. The details are as follows:

<? Php // phpinfo (); // $ conn = mssql_connect ('2017. 168.0.3 ', 'app', 'web') or die (mssql_get_last_message (); // if ($ conn )//{//? Echo "success"; //} else {//? Echo "fail"; //}?> <Html> 

The above is all the content of this article. I hope it will help you learn php programming.

Articles you may be interested in:
  • An example of PHP + MSSQL Paging
  • Php mssql database paging SQL statement
  • Continuous impact of php mssql paging SQL statement Optimization
  • Exquisite and beautiful php paging code
  • ThinkPHP paging usage
  • Beautiful paging method implemented by php
  • ThinkPHP usage tips-usage of pagination pages
  • ThinkPHP Method for retaining the search status by PAGE
  • Php + ajax Implementation of refreshing pagination
  • How to maintain conditional paging on the home page and search page during Thinkphp search

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.