我有这样的问题,我只想对所有车型进行分组和列出一次,我的问题如下所示:
我希望它看起来像这样:
MySQL:
$all_model = $mysqli->query("SELECT mark, mark_url, model, model_url, engine, engine_url, generation, generation_url, year_production, body_car, body_car_url FROM auta WHERE mark_url = '$code_curr[3]' and model_url = '$code_curr[4]' GROUP BY generation, body_car");
PHP:
<?php foreach ($all_model as $value): ?>
<div class="col-lg-3">
<div class="crand-car-container">
<?php echo "Generation:" . $value["generation"]; ?>
<a href="/<?php echo $value['mark_url'] ?>/<?php echo $value['model_url'] ?>/<?php echo $value['generation_url'] ?>/<?php echo $value['body_car_url'] ?>"><?php echo $value['mark'] . " " . $value['model'] . " " . $value['year_production'] . " [" . $value['generation'] . "]" ?></a>
</div>
</div>
<?php endforeach; ?>
慕尼黑5688855