/****** hack by www.stefanosilvestrini.com *****/
function getPicGallery($myalbumNum, $cid, $random) {
global $xoopsConfig;
$db =& Database::getInstance();
$myalbumNum = trim($myalbumNum);
if($random != 1) $sql = "SELECT s.lid AS lid, s.ext AS ext FROM ".$db->prefix('myalbum'.$myalbumNum.'_photos')." s, ".$db->prefix('myalbum'.$myalbumNum.'_cat')." t WHERE s.cid = t.cid AND s.cid = ".$cid." ORDER BY s.lid DESC LIMIT 1";
else $sql = "SELECT s.lid AS lid, s.ext AS ext FROM ".$db->prefix('myalbum'.$myalbumNum.'_photos')." s, ".$db->prefix('myalbum'.$myalbumNum.'_cat')." t WHERE s.cid = t.cid AND s.cid = ".$cid." ORDER BY RAND() LIMIT 1";
$result = $db->query($sql);
$myrow = $db->fetchArray($result);
$object = "";
return $object;
}
echo getPicGallery('X', 'Y', 'Z');
echo getPicGallery('', '1', '1');
|