ODBC-paged Display

Source: Internet
Author: User
$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.

  • Related Article

    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.