I am trying to display all the data from a mysql table into a html table and the php is getting the data fine but the table isnt displaying it properly this is my code:
<table border="1">
<tr>
<td>ID</td>
<td>Name</td>
<td>Phone Number</td>
<td>Email</td>
<td>Time</td>
<td>Number Of People</td>
<td>Time Placed</td>
</tr>
<?php
$host = "localhost";
$database = "reservation";
$user = "root";
$pass = "root";
//connection to the database
mysql_connect($host, $user, $pass)
or die ('cannot connect to the database: ' . mysql_error());
//select the database
mysql_select_db($database)
or die ('cannot select database: ' . mysql_error());
$sql = "SELECT * FROM reservation ORDER BY timeplaced";
$result = mysql_query($sql);
while($data = mysql_fetch_row($result)){
echo("<tr><td>$data[0]</td><td>$data[1]</td><td>$data[2]</td></tr><td>$data[3]</td></tr><td>$data[4]</td></tr><td>$data[5]</td></tr><td>$data[6]</td></tr>");
}
?>
</table>
please help, thanks.