我想从类别字段中的数据库中获取记录,旁边有一个按钮,当我点击该按钮时会出现一个引导崩溃,我必须在其中显示来自另一个数据库的记录。特定的类别字段,它应该按照上面的类别字段动态获取记录,并且从管理端进行更改时将继续更改。我想在SQL查询中编写PHP代码,下面的代码显示没有错误,但没有为我提供预期的结果。请帮帮我朋友。
<?php
$conn = mysqli_connect("localhost","root","","zuuvee");
$query = mysqli_query($conn, "SELECT * FROM category_name");
$query1 = mysqli_query($conn, "SELECT * FROM subcategory_name WHERE category = 'Apparel & Accessories'");
?>
<!DOCTYPE html>
<html>
<head>
<title>Category</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
</head>
<body>
<?php
while ($row = mysqli_fetch_array($query))
{
?>
<ul>
<li>
<span class="number"><?php echo $row['ID']; ?></span>
<span><a class="btn btn-primary" data-toggle="collapse" href="#third<?php echo $row['ID']; ?>" aria-expanded="false"></a>
<span><label name ="lb1"><?php echo $row['name']; ?></label></span>
<div class="collapse" id="third<?php echo $row['ID']; ?>">
<div class="card" style="width: 18rem;">
<div class="card-body">
<?php
while ($row1 = mysqli_fetch_array($query1))
{
?>
<h5 class="card-title"><?php echo $row1['subcategory']; ?></h5>
<?php
}
?>
</div>
</div>
</div></span>
<span class="points">00</span>
<span class="badge"><i class= "fa fa-microchip" aria-hidden="true"></i></span>
</li>
</ul>
<?php
}
?>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
</body>
</html>