Using ODBC paging display_PHP tutorial

WBOY
Release: 2016-07-21 16:02:38
Original
942 people have browsed it



$pagesize = 3;//Set the number 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);//Round 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 $pages+1;



?>





totalPages
";?>Homepage"; ?>
"; ?>Previous page"; ?>
"; ?>Next pages"; ? > "; ?>
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];

//Location search
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]




http://www.bkjia.com/PHPjc/316505.html

www.bkjia.com

true

http: //www.bkjia.com/PHPjc/316505.htmlTechArticle?php $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,i...
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