\n";
$count = 0;
$query = "SELECT p.category_id, c.photo_id, c.title FROM photos AS p, ";
$query .= "categories AS c WHERE p.category_id=c.category_id ";
if ($pref_date == 'taken') {
$query .= "GROUP BY p.category_id ORDER BY p.day_taken DESC";
}
else {
$query .= "GROUP BY p.category_id ORDER BY p.day_added DESC";
}
$result = mysql_query($query);
while (list($cat_id, $pid, $cat_name) = mysql_fetch_row($result)) {
if ($count == $pref_columns) {
$photos .= "
\n" . $table_end;
}
}
/*
v 1.1
All my fancy counting of table rows ignored what happens when there are
NO table rows -- i.e. a page with no thumbnails. So this fixes that.
*/
if (!preg_match("/<\/table>.?.?$/", $photos)) {
$photos .= "\n\n\n";
}
}
else {
print("Database down. Please try again later. Thanks!");
exit(0);
}
?>
=$pref_site?>