Very cool!
Based on your suggestion, I did this...
$sql = "SELECT id, category FROM categories ORDER BY category";
$result = mysql_query($sql, $db);
$x = 0;
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$sql = "SELECT c.id AS cat_id, c.category, a.id AS article_id, a.member, a.title, a.datesubmitted, m.id AS member_id, m.firstname, m.surname " .
"FROM categories c INNER JOIN articles a ON (c.id = a.category) INNER JOIN member m ON (a.member = m.id) " .
"WHERE c.id = $line[id] " .
"ORDER BY c.id, a.datesubmitted DESC, a.id DESC LIMIT 0,5";
$inner_result = mysql_query($sql, $db);
if ($x % 2 == 0) $links .= "<tr>";
$links .= "<td valign=top><table><tr><td><b>$line[category]</b></td></tr>\n";
while ($inner_line = mysql_fetch_array($inner_result, MYSQL_ASSOC)) {
$links .= "<tr><td><a href=\"article-details-testing.php?id=$inner_line[article_id]\">$inner_line[title]</a></td></tr>\n" .
"<tr><td class=\"tiny\">" . makeDate("m/d/y", $inner_line[datesubmitted]) . "</td></tr>\n" .
"<tr><td class=\"tiny\"><a href=\"member-profile-testing.php?id=$inner_line[member]\">" .
"$inner_line[firstname] $inner_line[surname]</a><br><br></td></tr>\n";
}
$links .= "</table></td>\n";
if ($x % 2 > 0) $links .= "</tr>\n\n";
$x++;
}
Its definitely faster, as there are now half as many hits on the database, but I am still running that query 38 times.
Thanks, DJ