Home > Backend Development > PHP Tutorial > Display article titles in pagination in php_PHP tutorial

Display article titles in pagination in php_PHP tutorial

WBOY
Release: 2016-07-13 10:58:59
Original
802 people have browsed it

How can I display it in pages when there are many article titles in php?

The following is the main code disclosed based on my experience, I hope it will be helpful to beginner netizens.

$page_size=10;(Number displayed on each page)

$sql='select count(*) as rnt from mydbf';

$sql .= ' order by mytime desc ';

$qh=mysql_query($sql);

$data=mysql_fetch_array($qh);

$nr=$data["cnt"];

$pages=intval($nr/$page_size);

if($nr%$page_size) $pages ;

if(empty($page))

{

$page=1;

$offset=0;

}

else

{

$offset=$page*$page_size-$page_size;

}

?>



 Page




?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631962.htmlTechArticleHow can we display it in pages when there are many article titles in php? The main code will be disclosed based on my experience below. Hope it will be helpful to beginner netizens. $page_size=10;(Display the number per page...
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