$pagesize = 3;//Set the number of displays per 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 Total Pages
$pagecount = $rs _num/$pagesize;
$pagecount 1 = intval ($pagecount);//Rounding Total pages
$compare = $pagecount-$pagecount 1;
Switch ($compare) {
Case "0":
$pagecount = Total pages $pagecount 1;//
Break
Default:
$pagecount 1++;
$pagecount = Total pages $pagecount 1;//
Break
};
if ($pagecount = = 0) $pagecount + +;
$fpages = $pages-1;
$bpages = $pages +1;
?>
Total Page Home Page Front Page Back Page Last page
|
$firstshow = ($pages-1) * $pagesize +1;//determine the first record per 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];
Locating lookups
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);
Show Records
while (Odbc_fetch_row ($rs)) {
};
?>
Close connection
Odbc_close ($conn _id);
?>
"The copyright of this article is owned by the author and house Orso near net, if need to reprint, please specify the author and source"
The above describes the ODBC with the page display of ODBC, including the content of ODBC, I hope that the PHP tutorial interested in a friend helpful.