Forum Moderators: open
id
category
lastmodified
subject
firstname
lastname
size
shortdesc while (list($category) = mysql_fetch_row($sth) {
$sth_list = sprintf("SELECT * FROM subjects WHERE category='%s' ORDER BY lastmodified DESC LIMIT 3",
mysqli_real_escape_string($dbh, $category));
...
}
(SELECT * FROM subjects WHERE category='category_1' ORDER BY lastmodified DESC LIMIT 3)
UNION
(SELECT * FROM subjects WHERE category='category_2' ORDER BY lastmodified DESC LIMIT 3)
UNION
(SELECT * FROM subjects WHERE category='category_3' ORDER BY lastmodified DESC LIMIT 3);
and so on with a select for each of your categories