The following piece of code prints the results of a query to an HTML table.
However, what I would like to do is prevent duplicate information from printing, but I'm not sure how.
I would think I would have to store the printed value in a variable and then check the variable against what is to be printed on the next pass through the loop.
print("<table border=\"1\" cellspacing=\"0\">\n");
//get information about fields
print("<tr>\n");
while ($field = mysql_fetch_field($dbResult))
{
print("<th><font size=3>$field->name</font></th>\n");
}
print("</tr>\n");
//get each row
while($row = mysql_fetch_row($dbResult))
{
print("<tr>\n");
foreach($row as $r)
{
print("<td><font size=2>$r </font></td>\n");
}
print("</tr>\n");
}
print ("</table>\n");
Thanks for your help,
William