PHPMSSQL paging instance (refresh), mssql paging _ PHP Tutorial

Source: Internet
Author: User
PHPMSSQL paging instance (refresh) and mssql paging. PHPMSSQL paging instance (refresh), mssql paging? Php * page description: * $ linkmssql_connect (MYSQL2005, sa, 123456) ordie (dblinkerror !. Mssql_error (); mssql_select_db (edu php mssql paging instance (refresh), mssql paging

/*
'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 ";

$ SQL = mssql_query ($ sqlstr );

$ Result = "";
While ($ result = mssql_fetch_array ($ SQL )){
Echo $ result ["id"].'
';
}

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 "homepage ";
Echo "previous page ";
}

If ($ page <$ pagecount)
{
Echo "next page ";
Echo "last page ";
}

}

?>

Http://www.bkjia.com/PHPjc/1119218.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1119218.htmlTechArticlePHP MSSQL paging instance (refresh), mssql paging? Php/* 'page description: */$ link = mssql_connect ("MYSQL2005", "sa", "123456") or die ("db link error! ". Mssql_error (); mssql_select_db (" edu...

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.