I am very new at using PHP and am trying to populate a table with data from a MySQL database, but the results that display are dotted all over the table and are not in their relevant columns at the top of the table.
Attached is a screenshot of where I need the data to be.
Here's the code.
Any help is appreciated.
<?php
$server = mysql_connect("xxxx", "xxxx", "xxxxx");
$db = mysql_select_db("xxxxxx", $server);
$query = mysql_query("SELECT * FROM stores");
?>
<html>
<head>
<title>Stores Tracker Dashboard</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p align="center"><font face="Arial"><strong>Stores Tracker Dashboard</strong></font></p>
<table align="center" border="1" width="90%">
<tr>
<td align="center"><font face="Arial"><strong>Not Started</strong></font></td>
<td align="center"><font face="Arial"><strong>In Transit</strong></font></td>
<td align="center"><font face="Arial"><strong>Awaiting Build</strong></font></td>
<td align="center"><font face="Arial"><strong>Being Built</strong></font></td>
<td align="center"><font face="Arial"><strong>On Return</strong></font></td>
<td align="center"><font face="Arial"><strong>Received Back</strong></font></td>
</tr>
<?php
while ($row = mysql_fetch_array($query)) {?>
<tr>
<td align="center"><font face="Arial"><?php if ($row['status'] == "Not Started") { echo $row['ticket'], ' (', $row['site'], ')'; }?></font></td>
<td align="center"><font face="Arial"><?php if ($row['status'] == "In Transit") { echo $row['ticket'], ' (', $row['site'], ')'; }?></font></td>
<td align="center"><font face="Arial"><?php if ($row['status'] == "Awaiting Build") { echo $row['ticket'], ' (', $row['site'], ')'; }?></font></td>
<td align="center"><font face="Arial"><?php if ($row['status'] == "Being Built") { echo $row['ticket'], ' (', $row['site'], ')'; }?></font></td>
<td align="center"><font face="Arial"><?php if ($row['status'] == "On Return from CFC2") { echo $row['ticket'], ' (', $row['site'], ')'; }?></font></td>
<td align="center"><font face="Arial"><?php if ($row['status'] == "Received") { echo $row['ticket'], ' (', $row['site'], ')'; }?></font></td>
</tr>
<?php } ?>