I'm sure this is such a newbie question, I'm almost embarrased to ask it...
I am trying to display results called from a MYSQL database in an HTML table. I have managed to get it to work, but am now trying to get it to loop after 3 columns. IE, having a table that starts a new row every 3 columns.
Anyway, the code I have used so far is:
<html>
<head>
<title>Displaying MySQL Data</title>
</head>
<body>
<?php
$db_host = "localhost";
$db_user = "root";
$db_pwd = "";
$db_name = "UPLOAD";
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
?>
<table border="1" align="center">
<tr>
<?php
$sql = "SELECT * FROM upload2";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)) {
echo "<td align='center' width='100'>"; echo "<a href='PHOTOS/".$row['name']."'><img src='PHOTOS/".$row['name']."'height='100'></a><br>".$row['name']."</td>";
}
?>
</tr>
</table>
</body>
</html>
Any ideas...I'm sure one of you fabulous people will be able to answer this in a blink of an eye, and I will be in awe of your supreme PHP ability.
Many thanks,
Dan