MySQLのデータを一覧表示
テーブルタグで表示する方法を二通り
必要なところだけphpで囲む(おすすめ)
<table> <tr> <th> ~~ </th> </tr> <?php while ($data = mysql_fetch_array($result)){ ?> <tr> <td> <?php echo $data[]; ?> </td> </tr> <?php } ?> </table>
全てphpで囲む
<?php echo "<table>"; echo "<tr>"; echo "<th>"; echo "</th>"; echo "</tr?"; while ($data = mysql_fetch_attay($result)){ echo "<tr>"; echo "<td>"; echo "</td>"; echo "</tr>"; } echo "</table>";
結果としては同じ形になりますが、見易さが違うので上の方のやり方をおすすめします。
他の人が見る可能性もあるのでインデントはしっかりしておきたいですね。