Use ODBC pagination .? Php $ pagesize3; set the total number of records displayed on each page to calculate the total number of records $ rs_numselectcount (*) asidfromtable; $ rs_numodbc_exec ($ conn_id, $ rs_num); $ rs_numodbc_result
$ Pagesize = 3; // you can specify the number of entries displayed on each page.
// Calculate the total number of records
$ Rs_num = "select count (*) as id from table ";
$ Rs_num = odbc_exec ($ conn_id, $ rs_num );
$ Rs_num = odbc_result ($ rs_num, "id ");
// Calculate the total number of pages
$ Pagecount = $ rs_num/$ pagesize;
$ Pagecount1 = intval ($ pagecount); // set the total number of pages
$ Compare = $ pagecount-$ pagecount1;
Switch ($ compare ){
Case "0 ":
$ Pagecount = $ pagecount1; // total number of pages
Break;
Default:
$ Pagecount1 ++;
$ Pagecount = $ pagecount1; // total number of pages
Break;
};
If ($ pagecount = 0) $ pagecount ++;
$ Fpages = $ pages-1;
$ Bpages = $ pages + 1;
?>
Total Page Homepage Previous Page Back page Last page
|
$ Firstshow = ($ pages-1) * $ pagesize + 1; // you can specify the first record on each page.
// Find the record number of the first record
$ Query_string = "SELECT * FROM table Order By id DESC ";
$ Query_string = odbc_exec ($ conn_id, $ query_string );
Odbc_fetch_into ($ query_string, $ firstshow, & $ idarea );
$ Idsql = $ idarea [0];
// Locate and find
If ($ pages = $ pagecount ){
$ Rs = "SELECT * FROM table where id <= '". $ idsql. "'Order By id DESC ";
} Else {
$ Rs = "SELECT Top". $ pagesize. "* FROM table where id <= '". $ idsql. "'Order By id DESC ";
};
$ Rs = odbc_exec ($ conn_id, $ rs );
// Display records
While (odbc_fetch_row ($ rs )){
};
?>
// Close the connection
Odbc_close ($ conn_id );
?>
[This article is copyrighted by the author and osuo. if you need to reprint it, please indicate the author and its source]
Http://www.bkjia.com/PHPjc/316505.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/316505.htmlTechArticle? Php $ pagesize = 3; // set the number of records displayed on each page // calculate the total number of records $ rs_num = select count (*) as id from table; $ rs_num = odbc_exec ($ conn_id, $ rs_num); $ rs_num = odbc_result ($ rs_num, I...