odbc uses ODBC paging display

WBOY
Release: 2016-07-29 08:34:27
Original
1243 people have browsed it

$pagesize = 3;//Set the number displayed 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 the total number of pages
$pagecount = $rs_num / $pagesize;
$pagecount1 = intval($pagecount);//Convert the total number of pages Rounding
$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;
?>

?pages=1>";?>Homepage"; ?>
"; ?>Previous page"; ?>
"; ?>Next page"; ?>
Last page"; ?>

$firstshow = ($pages-1)*$pagesize+1;//Determine the first record of 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];
//Positioning 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);
?>
[The copyright of this article is jointly owned by the author and Oso.com , if you need to reprint, please indicate the author and source]

The above introduces the paging display of odbc using ODBC, including the content of odbc. I hope it will be helpful to friends who are interested in PHP tutorials.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!