Basically I have a table w/ 2 fields in a mysql database. On my site i have a table of letters, and when the user clicks a letter, it creates an html table w/ the names from the database that start w/ that letter.
All i'm trying to do is figure out how to make that table have multiple columns w/o repeating the same record from the database. Might be a nested loop is needed, i'm not sure how to implement it though. here is the code so far for it.
Code: Select all
<?php
...
$result = mysql_query("SELECT * FROM list WHERE name LIKE 'A%' ORDER BY name");
echo "<table border='1'>
<tr>
<th>Bands</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . "<a href=\"/bands/list/" . $row['link'] . ".html\">" . $row['name'] . "</a>" . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>