I almost got it from another thread I found on this board, but something odd is happening -- it's displaying three thumbnails on the first row, then just one on the next, then 3, then one, and so on...
I'm thinking one of the $i = 0; commands is inside the wrong set of braces. I've tried moving them around, but I haven't got any good results - some put the first three on the first row, then the rest on the second, and sometimes, each gets its own row.
I know this can be done without having to calcuate the total records (which would be a hassle because the amount of records updates quite often).
If anyone sees something in the wrong place.. please let me know- I'm close!
<?
echo "<table border=\"0\" cellpadding=\"10\" class=\"thumb\">\n";
$sql = "SELECT * FROM stats ORDER by name ASC";
$sql_result = mysql_query($sql,$connection)
if (mysql_num_rows($sql_result) > 0) {
$i = 0;
while ($row = mysql_fetch_array($sql_result, 1)) {
if ($i == 0) {
echo "\n\t<tr>";
}
$i++;
if ($i == 4) {
echo "\n\t</tr>";
$i = 0;
}
echo "\n\t\t<td align=\"center\" valign=\"top\"><a href=\"models.php?query=portfolio&model=".$row["webname"]."\"><img src=\"models/thumbs/".$row["webname"].".jpg\" border=\"0\"/></a><br /><b><a href=\"models.php?query=portfolio&model=".$row["webname"]."\">".$row["name"]."</b></a><br />";
if($row["status"] == "U") {
echo "<font color=\"#FF0000\"><b>Updated!</b></font>";
}
elseif($row["status"] == "N") {
echo "<font color=\"#FF0000\"><b>New Model!</b></font>";
}
else {
echo "";
}
echo "</td>";
}
$i++;
}
echo "\n</table>\n";
?>