I have searched this forum (as well as many other forums), have disected codes and done all the research I can and STILL cannot find the answer. The closet I came was this thread which got me close, but I still never got it to work right.
I am using the code below to pull info from the db and display all albums released by this artist. Currently, it displays each release in a new <TD> which is great, but I would like to only show 5 <TD>'s per row. If there are more than 5 releases, then create a new row for the next 5 and so on...
Any help is greatly appreciated.
<?
$db = mysql_connect("localhost", "", "");
mysql_select_db("relapse_releases",$db);
$sql="SELECT * FROM entire_catalog WHERE artist='Amorphis' ORDER BY release_date_us DESC";
$result=mysql_query($sql,$db);
if(!mysql_num_rows($result))
{
echo(" ");
}
else
{
$num = mysql_num_rows($result);
$cur = 1;
echo "<p><table border=0 cellpadding=2 cellspacing=0 width=80% class=table_border>
<tr><td width=100%><table border=0 cellpadding=15 cellspacing=0 width=100% bgcolor=000000><tr>";
while ($num >= $cur) {
$row = mysql_fetch_array($result);
$artist = $row["artist"];
$title = $row["title"];
$release_date_us = $row["release_date_us"];
$catalog_number = $row["catalog_number"];
echo "<td valign=top width=125><center><a href=\"http://www.relapse.com/catalog/".$catalog_number.".php\">
<img src=\"http://www.relapse.com/albumart/".$catalog_number."_85.gif\" width=85 height=85 border=1>
<br><font class=artist><b>$artist</b></font>
<br><font class=title>\"$title\"</font></a></center></td>";
$cur++;
$row_count++;
}
echo "</tr></table></td></tr></table>";
}
?>
Thank you for looking,
Rick