表格未显示在HTML数据库中

时间:2013-12-11 05:11:09

标签: php html mysql sql

我正在创建一个数据库,在创建HTML脚本时,表格将返回,没有寄宿生=姓氏姓氏“;

while($row = mysqli_fetch_array($result)) { 
    echo ""; 
    echo "" . $row['Firstname'] . ""; 
    echo "" . $row['Lastname'] . ""; 
    echo ""; 
} 
echo ""; 
mysqli_close($con); ?> 

这是我创建的代码,有人可以看一下并告诉我我做错了吗?

<?php
$con=mysqli_connect("localhost","root","","Franchise_Call_Log");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con,"SELECT * FROM caller_info");

echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
th>Franchise</th>
</tr>";

while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Firstname'] . "</td>";
echo "<td>" . $row['Lastname'] . "</td>";
echo "<td>" . $row['Franchise'] . "</td>";
echo "</tr>";
}
echo "</table>";

mysqli_close($con);
?> 

2 个答案:

答案 0 :(得分:1)

查看标签

<th>Franchise</th>

答案 1 :(得分:0)

请将您的文件扩展名更改为.php它不会渲染您的脚本。 Html文件不会渲染您的PHP,并根据@suhail的建议更正您的标记。