国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP develops a simple book background management system to implement book query function

We have already implemented the new book management paging function of the book backend management system.

The paging function queried here is basically the same as mentioned above.

This section mainly explains the query function and adds the query function to the paging function.

51.png

Use the SQL LIKE operator to search for a specified pattern in a column in the WHERE clause.

Query book information by selecting the type and entering the query fields.

<?php
$SQL = "SELECT * FROM yx_books where ".$_POST['seltype']." like ('%".$_POST['coun']."%')";
?>

Also add the selection type and query input field to the data displayed on each page

<?php
$SQL = "SELECT * FROM yx_books where ".$_POST['seltype']." like ('%".$_POST['coun']."%') order by id desc limit $startno,$pagesize";
?>

Finally, loop out the database query data through the while statement

<?php
while($rows=mysqli_fetch_assoc($rs))
{
   ?>
   <tr align="center">
      <td class="td_bg" width="7%"><?php echo $rows["id"]?></td>
      <td class="td_bg" width="28%" height="26"><?php echo $rows["name"]?></td>
      <td class="td_bg" width="12%" height="26"><?php echo $rows["price"]?></td>
      <td class="td_bg" width="24%" height="26"><?php echo $rows["uploadtime"]?></td>
      <td class="td_bg" width="12%" height="26"><?php echo $rows["type"]?></td>
      <td class="td_bg" width="24%">
         <a href="update.php?id=<?php echo $rows['id'] ?>" class="trlink">修改</a>&nbsp;&nbsp;
         <a href="del.php?id=<?php echo $rows['id'] ?>" class="trlink">刪除</a></td>
   </tr>
   <?php
}
?>

The functions of displaying the home page, previous page, next page, and last page at the bottom are basically similar to the previous new book management paging function.

<tr>
   <th height="25" colspan="6" align="center" class="bg_tr">
      <?php
      if($pageno==1)
      {
         ?>
         首頁 | 上一頁 | <a href="?pageno=<?php echo $pageno+1?>">下一頁</a> |
         <a href="?pageno=<?php echo $_POST['seltype']?>">末頁</a>
         <?php
      }
      else if($pageno==$pagecount)
      {
         ?>
         <a href="?pageno=1">首頁</a> | <a href="?pageno=<?php echo $pageno-1?>">上一頁</a> | 下一頁 | 末頁
         <?php
      }
      else
      {
         ?>
         <a href="?pageno=1">首頁</a> | <a href="?pageno=<?php echo $pageno-1?>">上一頁</a> |
         <a href="?pageno=<?php echo $pageno+1?>" class="forumRowHighlight">下一頁</a> |
         <a href="?pageno=<?php echo $pagecount?>">末頁</a>
         <?php
      }
      ?>
      &nbsp;頁次:<?php echo $pageno ?>/<?php echo $pagecount ?>頁&nbsp;共有<?php echo $recordcount?>條信息 </th>
</tr>


Continuing Learning
||
<?php $pagesize = 8; //每頁顯示數(shù) $sql = "select * from yx_books where ".$_POST['seltype']." like ('%".$_POST['coun']."%')"; $rs=mysqli_query($link,$sql) or die("請輸入查詢條件!!!"); $recordcount=mysqli_num_rows($rs); //mysql_num_rows() 返回結(jié)果集中行的數(shù)目。此命令僅對 SELECT 語句有效。 $pagecount=($recordcount-1)/$pagesize+1; //計算總頁數(shù) $pagecount=(int)$pagecount; $pageno = $_GET["pageno"]; //獲取當(dāng)前頁 if($pageno=="") { $pageno=1; //當(dāng)前頁為空時顯示第一頁 } if($pageno<1) { $pageno=1; //當(dāng)前頁小于第一頁時顯示第一頁 } if($pageno>$pagecount) { $pageno=$pagecount; //當(dāng)前頁數(shù)大于總頁數(shù)時顯示總頁數(shù) } $startno=($pageno-1)*$pagesize; //每頁從第幾條數(shù)據(jù)開始顯示 $sql="select * from yx_books where ".$_POST['seltype']." like ('%".$_POST['coun']."%') order by id desc limit $startno,$pagesize"; $rs=mysqli_query($link,$sql); ?>
submitReset Code