1
Mods & Plugins (Requests & Discussions) / random pics from newest categorys
« on: June 18, 2003, 04:37:00 PM »
I found a little workaround - I look for the highest ID which is normally the newest category and give out only pictures from this category.
to do this, you have to add this little code (be sure to change the prefix if necessary!):
then find
and replace it with:
to do this, you have to add this little code (be sure to change the prefix if necessary!):
Code: [Select]
$sql_maxcat ="SELECT max(cat_id) as maxcat FROM 4images_categories";
$result2 = $DB->query($sql_maxcat);
$row2 = $DB->fetch_row($result2);
$maxcat = $row2['maxcat'];
then find
Code: [Select]
SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, b.cat_name
FROM 4images_images a, 4images_categories b
WHERE a.image_active=1
AND a.cat_id = b.cat_id
AND b.auth_viewcat=0
AND b.auth_viewimage=0
LIMIT $number, 1
and replace it with:
Code: [Select]
SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, b.cat_name
FROM 4images_images a, 4images_categories b
WHERE a.image_active=1
AND a.cat_id = b.cat_id
AND b.cat_id = $maxcat
AND b.auth_viewcat=0
AND b.auth_viewimage=0
LIMIT $number, 1