国产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)
      {
         ?>
         首頁(yè) | 上一頁(yè) | <a href="?pageno=<?php echo $pageno+1?>">下一頁(yè)</a> |
         <a href="?pageno=<?php echo $_POST['seltype']?>">末頁(yè)</a>
         <?php
      }
      else if($pageno==$pagecount)
      {
         ?>
         <a href="?pageno=1">首頁(yè)</a> | <a href="?pageno=<?php echo $pageno-1?>">上一頁(yè)</a> | 下一頁(yè) | 末頁(yè)
         <?php
      }
      else
      {
         ?>
         <a href="?pageno=1">首頁(yè)</a> | <a href="?pageno=<?php echo $pageno-1?>">上一頁(yè)</a> |
         <a href="?pageno=<?php echo $pageno+1?>" class="forumRowHighlight">下一頁(yè)</a> |
         <a href="?pageno=<?php echo $pagecount?>">末頁(yè)</a>
         <?php
      }
      ?>
      &nbsp;頁(yè)次:<?php echo $pageno ?>/<?php echo $pagecount ?>頁(yè)&nbsp;共有<?php echo $recordcount?>條信息 </th>
</tr>


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