php云存储平台源代码
发布时间: 2024-05-28 21:02:11
① PHP 怎么显示数据库中的数据 求源代码
读数据库,以表格输出的示例代码:内
<?php
header('Content-type:text/html;charset=utf-8');
$db = new mysqli('localhost','root','root','books');
$rows = $db->query('SELECT * FROM customers');
echo '<table border="1"><tr><td>姓名</td><td>年龄容</td></tr>';
while($row = $rows->fetch_assoc()){
echo '<tr><td>'.$row['name'].'</td>';
echo '<td>'.$row['address'].'</td></tr>';
}
?