<? PHP
// Connect to the database
$ Myserver = "192.168.0.123"; // host
$ Myuser = "sa"; // User Name
$ Mypass = ""; // Password
$ Mydb = ""; // MSSQL database name
$ S = mssql_connect ($ myserver, $ myuser, $ mypass );
$ D = mssql_select_db ($ mydb, $ S );
// Paging information/
$ Biao = "yonghujiben ";
$ Xianshi = 30; // number of entries displayed on each page
// Open the user table. This table mainly calculates the total number of records and can be divided into several pages.
$ SQL = "select * from $ Biao ";
$ Query = mssql_query ($ SQL );
$ Zongshu = mssql_num_rows ($ query );
$ Yeshu = Ceil ($ zongshu/$ xianshi); // return the maximum integer of the current decimal number.
Echo "$ Yeshu page in total ";
If ($ page = "" or $ page> $ Yeshu or $ page <0 or $ page = 0) {$ page2 = 1 ;}
Else
{
$ Page2 = intval ($ page); // convert the page number to a number
}
// $ Page2 = intval ($ page); // convert the page number to a number
Echo $ seek = $ xianshi * ($ page2-1 );
Echo "<br> ";
Echo $ xianshi;
$ Top_shuzi = $ page2 * $ xianshi;
// User display data in this table
$ SQL _e = "select top $ top_shuzi * from $ Biao ";
$ Query_e = mssql_query ($ SQL _e );
Echo "<br> ";
Mssql_data_seek ($ query_e, $ seek );
While ($ rs = mssql_fetch_object ($ query_e ))
{
// Print_r ($ row );
Echo $ RS-> QQ;
Echo "<br> ";
}
?>
<? PHP
$ Xianshiye = 8; // displays the current page at a time.
$ I = $ xianshiye + ($ page2-1 );
If ($ I> $ Yeshu)
{$ I = $ Yeshu ;}
If ($ page2> 1)
{
$ Shangyiye = $ page2-1;
Echo "<a href = '$ php_self? Page = $ shangyiye '> previous page </a>/N ";}
If ($ page2-$ xianshiye <1 or $ page2-$ xianshiye = 0)
{
$ QQ = 1;
}
Else
{
$ QQ = $ page2-$ xianshiye;
}
For ($ Y = $ QQ; $ Y <= $ page2-1; $ y ++)
{
Echo "<a href = $ php_self? Page = $ Y> [$ y] </a>/N ";
}
For ($ Y = $ page2; $ Y <= $ I; $ y ++)
{
Echo str_replace ("<a href = $ php_self? Page = $ Y> [$ page2] </a> "," <strong> $ Y </strong> "," <a href = $ php_self? Page = $ Y> [$ y] </a>/N ");
// Echo "<a href = $ php_self? Page = $ Y> $ Y </a>/N ";
}
If ($ page2 = $ Yeshu)
{}
Else
{
$ Xiayiye = $ page2 + 1;
Echo "<a href = '$ php_self? Page = $ xiayiye '> next page </a> ";}
?>