我很难弄清楚如何让我的表格显示为网页。
其他一切工作正常。我已经能够使用表格将记录写入表格,但我根本无法显示表格。
这是我的代码:
$host = "***";
$userName = "***";
$passWord = "***";
$db = "doctorWho";
mysql_connect($host,$userName,$passWord);
mysql_select_db($db) or die( "Unable to access database");
$query = "SELECT * FROM patients";
$result = mysql_query($query);
echo "<table border='1'>
<tr>
<th>Last Name</th>
<th>First Name</th>
<th>Address</th>
<th>Age</th>
<th>Sex</th>
<th>Marital Status</th>
<th>Medication</th>
<th>Date Rx'd</th>
<th>Quantity</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['lastName'] . "</td>";
echo "<td>" . $row['firstName'] . "</td>";
echo "<td>" . $row['address'] . "</td>";
echo "<td>" . $row['age'] . "</td>";
echo "<td>" . $row['sex'] . "</td>";
echo "<td>" . $row['maritalStatus'] . "</td>";
echo "<td>" . $row['medication'] . "</td>";
echo "<td>" . $row['medsWhen'] . "</td>";
echo "<td>" . $row['medsQuant'] . "</td>";
echo "</tr>";
}
echo "</table>";