I am in need of some assistance regarding table creation in PHP. In my code, my table is printing way too many times. For some reason, the output of the code is whatever the count of the number of results is ^2. So, if I have 4 results in the actual database, I have 16 results in the output. I would like to do a bit more research before posting in the forums, but I am new to php and have no idea where to begin.
//Count the number of rows returned
$count = mysql_num_rows($result);
echo $count;
//Table header
echo "<div><table id=\"tableheader\" bgcolor=\"#4382b5\">\n";
echo "<tr>\n";
echo "<td> 3-4 ID:</td>\n";
echo "<td> First Name:</td>\n";
echo "<td> Last Name:</td>\n";
echo "<td> HCA:</td>\n";
echo "<td> File:</td>\n";
echo "<tr>";
echo "</table></div>";
if ($count !== 0) {
while($row = mysql_fetch_array($result)) {
echo "<div class=\"addform\"><form method='get' action=\"update.php\">\n";
echo " <input type=\"text\" value=\"".$row['tfid']."\" name=\"column1\">\n";
echo " <input type=\"text\" name=\"column2\" value=\"".$row['fname']."\"/>\n";
echo " <input type=\"text\" name=\"column3\" value=\"".$row['lname']."\"/>\n";
echo " <input type=\"text\" name=\"column4\" value=\"".$row['hca']."\"/>\n";
echo " <input type=\"text\" name=\"column5\" value=\"".$row['file']."\"/>\n";
echo " <input type=\"image\" src=\"images/update.png\" alt=\"Update Row\" class=\"update\" title=\"Update Row\">\n";
echo "<a href=\"delete.php?tfid=".$row['tfid']."\"><img title='Delete Row' alt=\"Delete\" class='del' src='images/delete.png'/></a></form></div>\n";
}
echo "</table><br />\n";
} else {
echo "<b><center>NO DATA</center></b>\n";
}