user3085177
user3085177

Reputation: 27

Tables not showing in HTML database

I am creating a database and when creating the HTML script the table is coming back with no boarders = Firstname Lastname ";

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

Here is the code I created, could someone look at it and tell me what I have done wrong?

<?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);
?> 

Upvotes: 0

Views: 109

Answers (2)

Roopendra
Roopendra

Reputation: 7776

Please change your file extension to .php it is not rendering your script. Html file not render your php, and also correct your markup as suggested by @suhail.

Upvotes: 0

Dev
Dev

Reputation: 662

Look at the tag

<th>Franchise</th>

Upvotes: 1

Related Questions