Here is the code so far...
function phpblock_new4albums() {
global $_CONF, $_USER, $_TABLES;
$limit = "5";
$imgdir = "gallery";
$img_sql = DB_query("SELECT image_id FROM 4images_images");
$img_num = DB_numRows($img_sql);
$cat_sql = DB_query("SELECT cat_id FROM 4images_categories
WHERE (cat_parent_id!=0)");
$cat_num = DB_numRows($cat_sql);
$new .='<center>(' .$img_num. ' images in ' .$cat_num. '
albums)</center>';
// DATABASE
$new_sql = DB_query("SELECT DISTINCT cat_id,image_id FROM
4images_images ORDER BY image_id DESC LIMIT $limit");
while($N = DB_fetchArray($new_sql)){
$album =
DB_getItem("4images_categories",cat_name,"cat_id=$N[cat_id]");
$date =
DB_getItem("4images_images",image_date,"image_id=$N[image_id]");
$date = strftime('%b %d, %Y', $date);
$new .='<table width="98%"><td width="100%">';
$new .='<a href="' .$_CONF['site_url']. '/' .$imgdir.
'/categories.php?cat_id=' .$N['cat_id']. '">' .$album. '</a><br/>';
$new .='last updated: ' .$date;
$new .='</td></table>';
}
return $new;
}
>// DATABASE
> $new_sql = DB_query("SELECT DISTINCT cat_id,image_id FROM
>4images_images ORDER BY image_id DESC LIMIT $limit");
Change this SQL statement to:
$new_sql = DB_query("SELECT cat_id, MAX(image_id) as image_id FROM
4images_images GROUP BY cat_id ORDER BY image_id DESC LIMIT $limit");
That should do the trick.
--
YAWNS (Yet Another neverWinter Nights fan Site)
http://home.attbi.com/~cavebear/
Santa is Missing! Christmas adventure for NWN
http://nwvault.ign.com/Files/modules/data/1042522123185.shtml
jp