以下代码仅提取CustomerID和电子邮件,第2列和第3列不显示任何数据。我做错了什么?
<?php
/*
VIEW.PHP
Displays all data from 'customer' table
*/
// connect to the database
include('customerDBconnection.php');
// get results from database
$result = mysql_query("SELECT * FROM customer")
or die(mysql_error());
echo "<table border='0.2' cellpadding='10'>";
echo "<tr>
<th>ID</th>
<th>Name</th> `enter code here`
<th>SimcardNumber</th>
<th>email</th>
<th>email</th>
</tr>";
// loop through results of database query, displaying them in the table
下面的表显示假设从phpmyadmin调用列只调用第一列和第四列,其余的都保留为空白
while($row = mysql_fetch_array( $result )) {
// echo out the contents of each row into a table
echo "<tr>";
echo '<td>' . $row['CustomerID'].'</td>';
echo '<td>' . $row['Name']. '</td>';
echo '<td>' . $row['SimcardNumber'].'</td>';
echo '<td>' . $row['email']. '</td>';
echo "</tr>";
}
// close table>
echo "</table>";
?>