时间:2021-07-01 10:21:17 帮助过:30人阅读
利用表格的格式:
<body> <table width="100%" border="1" cellpadding="0" cellspacing="0"> <tr> <td>代号</td> <td>名称</td> <td>编号</td> </tr> <?php $db = new MySQLi("localhost","root","12345678","heiheihei"); $sql = "select * from cou "; $r = $db->query($sql); if($r) { while ($attr = $r->fetch_row()) { echo " <tr> <td>{$attr[0]}</td> <td>{$attr[1]}</td> <td>{$attr[2]}</td> </tr>"; } } ?> </table> </body> </html>
反正套路都差不多啦
将数据库中的信息显示在网页上
标签:网页 pre 名称 query style att student localhost result