Added page number jump text box The following are the instructions for beginners
Copy the code The code is as follows:
$phpfile = 'index.php';//Page file name $page= isset($_GET['page'])?$_GET['page'] :1;//Default page number $db = mysql_connect('localhost','test','test');//Link database mysql_select_db('test',$db);//Select database $counts = mysql_num_rows(mysql_query('select `id` from `test`',$db));//Get the total number of data required $sql='select `id`,`title` from `test`';//Define the query statement SQL $getpageinfo = page($page,$counts,$phpfile);//Call the function to generate paging HTML and SQL LIMIT clause $sql.=$ getpageinfo['sqllimit'];//Combine the complete SQL statement $data = $row = array();//Initialize the array $result = mysql_query($sql,$db);//Get the result Set //Load the data into the $data array while($row = mysql_fetch_array($result)){ $data[]=$row; } ?> echo $getpageinfo['pagecode'];//Display the paging html code ?>
http://www.bkjia.com/PHPjc/319325.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319325.htmlTechArticleCopy the code as follows: ?php functionpage($page,$total,$phpfile,$pagesize=10,$ pagelen=7){ $pagecode='';//Define variables to store the HTML generated by paging $page=intval($page);//Avoid non-numbers...
Statement:
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