【发布时间】:2021-12-27 23:36:35
【问题描述】:
我是学生,所以我是代码初学者。
我在 MySQL 的数据库中进行了搜索,结果是一个包含 3 个其他表的表:
array (size=3)
0 =>
array (size=4)
'type_de_sport' => string 'boxe' (length=4)
'Adresse' => string '33 rue de Paradis' (length=17)
'ville' => string 'Marseille' (length=9)
'code_postal' => string '13006' (length=5)
1 =>
array (size=4)
'type_de_sport' => string 'boxe' (length=4)
'Adresse' => string '44 boulevard Sakakini' (length=21)
'ville' => string 'Marseille' (length=9)
'code_postal' => string '13005' (length=5)
2 =>
array (size=4)
'type_de_sport' => string 'BOXE' (length=4)
'Adresse' => string 'place a moi' (length=11)
'ville' => string 'Marseille' (length=9)
'code_postal' => string '13000' (length=5)
我想整理一下这个结果,我试过了,但是没有用:
<table>
<thead>
<tr>
<th scope="col">Type de sport</th>
<th scope="col">Adresse </th>
<th scope="col">Ville</th>
<th scope="col">code postal</th>
</tr>
</thead>
<tbody>
<? for ($i=0; $i >$num ; $i++){ ?>
<tr>
<th scope="row"><?php $row=$i + 1 ; ?></th>
<?php foreach ($resultats[$i] as $contenu) { ?>
<td><?= $contenu ; ?></td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
请问您还有其他想法吗?
最好的问候
【问题讨论】:
-
“没用”到底是怎么回事?一个错误?出乎意料的结果?在这个相当简单的情况下,我可以猜到,但总的来说,在询问代码问题时,您应该始终对您的问题给出清晰准确的解释。它使人们更容易帮助您。否则他们只需要从问你问题开始。
-
你的输出应该是什么样的,你得到了什么?具体说明软件版本。审查结束。