试图在我的 foreach 循环中实现链接。但是,无法使 $category 链接正常工作。任何指针?设法使链接适用于子类别,如下所示:
<?
$output = mysqli_query("SELECT * FROM bikes, bikeTypes WHERE bikes.model_id = bikeTypes.model_id");
$result = array();
while($row = mysqli_fetch_array($output))
{
$result[$row['model']][] = $row;
}
foreach ($result as $category => $values) {
echo "<li>".$category.'<ul>';
foreach ($values as $value) {
echo "<a href='details.php?id=" . $row['model_id'] . "'><li>" . $value['bikeName'] . "</a></li>";
}
echo '</ul>';
echo '</li>';
}
?>
提前感谢您的帮助!:)