我正在尝试在包含用户 SQL 数据的 html 页面上显示一个表格。
假设我可以连接并且表中有信息。
<?php
echo "<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Hair Color</th>
</tr>";
$result = mysql_query("SELECT * FROM `table`");
while($row = mysql_fetch_assoc($result))
{
echo "<tr>";
echo "<td>" .$row['first']."</td>";
echo "<td>".$row['last']."</td>";
echo "<td>".$row['color']."</td>";
echo "</tr>";
}
echo "</table>";
echo "<input type="button" value="updateTable" id="btn">";
?>
因为没有数据输出,我哪里出错了?