include("/home/xoneseve/x17online.com/html/pics/includes/db.php"); $hot_pix_gallery_id = 4554; $total_pics = 100; // number of pics to show in cycle $gal_dir = "/gallery/galleries/test-hot-pix-20090421/full/"; $qry = "select * from galleries where gallery_id = 4554"; $result = mysql_query($qry); $gallery = mysql_fetch_object($result); $qry = "select * from gallery_image_map where gallery_id = 4554 order by image_id desc limit $total_pics"; $photos = mysql_query($qry); # get the newest 3 galleries $qry = "select * from galleries where status = 'ONLINE' order by added_on desc limit 3"; $result = mysql_query($qry); while ($gal = mysql_fetch_object($result)) { $newest_galleries[] = $gal; } # get the first thumbnail for each of the new galleries foreach ($newest_galleries as $gal) { $qry = "select * from gallery_image_map where gallery_id = $gal->gallery_id order by image_id asc limit 1"; $result = mysql_query($qry); $newest_gallery_images[$gal->gallery_id] = mysql_fetch_object($result); } ?>