Php 查询结果并按类别将其循环到表中

Php 查询结果并按类别将其循环到表中,php,html,mysql,Php,Html,Mysql,我正在尝试查询我的products表 +-------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------------+--------------+------+-----+---------+----------------+

我正在尝试查询我的products表

+-------------------+--------------+------+-----+---------+----------------+
| Field             | Type         | Null | Key | Default | Extra          |
+-------------------+--------------+------+-----+---------+----------------+
| id                | int(11)      | NO   | PRI | NULL    | auto_increment |
| name              | varchar(50)  | NO   |     | NULL    |                |
| make              | varchar(50)  | NO   |     | NULL    |                |
| email             | varchar(200) | NO   |     | NULL    |                |
| category          | longtext     | NO   |     | NULL    |                |
+-------------------+--------------+------+-----+---------+----------------+
我想查询数据库并在这样的表中回显结果,我想让它回显类别名称,然后回显所有包含名称、品牌和其他一些细节等的内容

我想这样表现出来

Category:
name       name       name       name
-------------------------------------
Category:
name       name       name       name
-------------------------------------
Category:
name       name       name       name
-------------------------------------
Category:
name       name       name       name
-------------------------------------
其中,每个名称在产品表中都是不同的产品。不确定在何处查找和搜索内容。

**请检查此项**
**Check this**

$get_query="select * from products";
@$show_pro=mysqli_query($conn,$get_query);

echo '<div id="show_table" height:400px;">';
echo '<table id="show" border="1" bordercolor="#000000">
        <tr>
            <th> ID </th>
            <th> Name </th>
            <th> Make</th>
            <th> Email</th>
            <th> Category </th> 
        </tr>';

while($row_pro = mysqli_fetch_array($show_pro, MYSQLI_BOTH))
{
    $id = $row_pro['id'];
    $name = $row_pro['name'];
    $make= $row_pro['make'];
    $email= $row_pro['email'];
    $category = $row_pro['category'];


    echo '

        <tr>
        <td width="50" >"'.$id.'"</td>
        <td width="50">"'.$name.'"</td>
        <td width="50">"'.$make.'"</td>
        <td width="50">"'.$email.'"</td>
        <td width="50">"'.$category.'"</td>
        </tr>



    ';

}
echo'</table>';
echo '</div>';
$get\u query=“选择*来自产品”; @$show\u pro=mysqli\u query($conn,$get\u query);
echo“这可以通过html表和一些循环来实现。也许一些if语句sdatatables也是我以前使用过的(几个月前)。如果您的数据集不大,或者预计不会变大,则可以将所有内容读取到一个数组中,然后在输出之前根据类别对其进行排序或拆分。的可能重复项