What are the new features of iphone5? PHP paging function

WBOY
Release: 2016-07-29 08:36:53
Original
1344 people have browsed it

//Establish database connection
$link = mysql_connect("localhost", "root", "wyh7ye") ;
; // Get the current page number
mysql_select_db("test",$link);
if(isset($_GET[page]))...{
$page = intval($_GET[page]);
}
else...{
$page = 1;
}
//Quantity per page
$page_size =4;
//Get the total data amount
$sql = "select * from user";
$result = mysql_query($sql,$link);
while($row = mysql_fetch_array($result))...{
$i=$i+1;
}
$amount = $i;
// Calculate how many pages there are in total
if( $amount )...{
if( $amount < $page_size )...{ $page_count = 1; } //If the total data amount is less than $PageSize, then there is only one page
if( $amount % $page_size )...{ //Get the remainder after dividing the total data amount by the number of pages
       $page_count = (int)($amount / $page_size) + 1; //If there is a remainder, the number of pages is equal to the total data amount divided by the number of pages, rounded up and plus one
}else...{
       $page_count = $amount / $page_size; //If there is no remainder, the number of pages is equal to the total data amount divided by the number of pages per page
}
}
else...{
$page_count = 0;
}
// Get data and return the result in two-dimensional array format
if( $amount )...{
$sql = "select * from user order by id desc limit ". ($page-1)*$page_size .",$page_size";
$result =mysql_query($sql,$link);
while ($row =mysql_fetch_array($result))...{
?>



   
   
   
   


}
}
// Page turning link
$page_string="";
if( $page == 1 )...{
$page_string.="First page|Previous page|";
}
else...{
$page_string.= "First page|href=?page=".($page-1).">Previous page|";
}
if( ($page == $page_count) || ($page_count == 0) )...{
$page_string.="Next page|Last page";
}
else...{
$page_string.= "Next page|";
}
echo $page_string;
?>

The above introduces what are the new features of iphone5 and the paging function of PHP, including what are the new features of iphone5. I hope it will be helpful to friends who are interested in PHP tutorials.

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!