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

PHP develops a simple book background management system to realize book statistics

In this section, there is a book statistics column "Book Statistics" function page in the menu management bar.

Use this page to classify and count all books, as shown in the figure

53.png

html uses <table> table, which uses <tr><td> layout, plus css style.

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" class="table">
<tr>
<td height="27" colspan="2" align="left" bgcolor="#FFFFFF" class="bg_tr">&nbsp;后臺管理&nbsp;>>&nbsp;圖書統(tǒng)計</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF" height="27">圖書類別</td>
<td align="center" bgcolor="#FFFFFF">庫內(nèi)圖書</td>
</tr>
</table>

The content is displayed through SQL statement query

The COUNT(*) function is used here to return the number of records in the table.

When using the GROUP BY statement, it is used in combination with the total function to group the result set based on one or more columns.

Use group by to group type.

<?php
$SQL = "SELECT type, count(*) FROM yx_books group by type";
?>

Finally use a while loop to retrieve the data queried from the database

<?php
$SQL = "SELECT type, count(*) FROM yx_books group by type";
$val=mysqli_query($link,$sql);
while($arr=mysqli_fetch_row($val)){
   echo "<tr height='30'>";
   echo "<td align='center' bgcolor='#FFFFFF'>".$arr[0]."</td>";
   echo "<td align='center' bgcolor='#FFFFFF'>本類目共有:".$arr[1]."&nbsp;種</td>";
   echo "</tr>";
}
?>

Note:

The mysql_fetch_row() function obtains a row from the result set as a numeric array.

Return value: Returns the array generated based on the rows obtained, or returns false if there are no more rows.


Continuing Learning
||
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>PHP圖書管理系統(tǒng)圖書統(tǒng)計</title> <style> .table{ border: 1px solid #CAF2FF;/*邊框顏色*/ margin-top: 5px; margin-bottom: 5px; background:#a8c7ce; } .td_bgf { background:#d3eaef; color:#000000; } .td_bg { background:#ffffff; color:#344b50; } .bg_tr { font-family: "微軟雅黑,Verdana, 新宋體"; color:#e1e2e3;/*標(biāo)題字體色*/ font-size:12px; font-weight:bolder; background:#353c44;/*標(biāo)題背景色*/ line-height: 22px; } td { color:#1E5494; font-size:12px; line-height: 18px; } </style> </head> <body> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" class="table"> <tr> <td height="27" colspan="2" align="left" bgcolor="#FFFFFF" class="bg_tr"> 后臺管理 >> 圖書統(tǒng)計</td> </tr> <tr> <td align="center" bgcolor="#FFFFFF" height="27">圖書類別</td> <td align="center" bgcolor="#FFFFFF">庫內(nèi)圖書</td> </tr> </table> </body> </html>
submitReset Code