Simple page jump function implementation code written in php_PHP tutorial

WBOY
Release: 2016-07-13 17:17:42
Original
1220 people have browsed it

Not much to say, just go to the code

Copy the code The code is as follows:

//Link database' query
mysql_connect( 'localhost','username','userpwd')or die("Database link failed".mysql_error());
mysql_select_db('library name');
mysql_query('set names utf8');
$sql1="select * from user ";
$query1=mysql_query($sql1);
$count=array();
while($row=mysql_fetch_assoc($query1)){
$count[]=$row;
}
$totalnews=count($count);
//Judge page
if($_GET['page']){
$page=$_GET['page'];
}else{
$page=1;
}
$start=($page-1)*$newnum;
$sql ="select * from user limit $start,$newnum";
$query=mysql_query($sql);
$ret=array();
while($row=mysql_fetch_assoc($query)) {
$ret[]=$row;
}
?>
//Table style


< ;?php foreach ($ret as $key=>$value){ ?>
                                                                                                                   ;/td>
; ?>

//Page jump
   
Homepage < a href="upload.php?page=">Previous page / Nextpage Last page
                                                                                                                             



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

www.bkjia.com

true
http: //www.bkjia.com/PHPjc/621714.html

TechArticle

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!