在html中想遍历展示一下数据库的一张表,但数据库的内容不显示,只显示乱码(编写的代码),代码在infinityfree上写的,想请教一下好心程序员萌是不是哪个地方出了问题。
代码如下:
<?php
header("content-type:text/html;charset=utf-8");
$link = mysqli_connect("sql113.epizy.com","epiz_31266886","Ic4JztybZ73wMlV","epiz_31266886");
if (!$link) {
die("fail to connect " . mysqli_connect_error());
}
$sql = "select * from User_Table";
$result = mysqli_query($link,$sql);
echo"
<table><table>//这个地方多加了个<table>是因为不加连表格也显示不出,web会全部视为乱码
<tr>
<th>Profile Picture</th>
<th>Information</th>
<th>operation</th>
</tr>";
while($row = mysqli_fetch_array($result))//这里开始web就不识别了
{
echo "<tr>";
print "<td >Photo</td>";
print "<td>{$row["User_ID"]}<br>{$row["Userame"]}<br>{$row["Email"]}<br>{$row["Password"]}<br><A href="ShowProfile.html">more information </A></td>";
echo"<th><div class="btn-group">
<button class="button"><A href="Security.html">Edit</A></button>
<button class="button">Ban</button>
<button class="button">Delete</button>
</div></th>
";
echo "</tr>";
}
echo "</table>";
mysqli_close($link);
?>
运行结果图示