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