View Single Post
Old January 13th, 2005, 01:45 PM   #2 (permalink)
Brian
Guest
 
Posts: n/a
Re: is there a SUM of all views in one (sub_)Cat?

I wouldn't recommend this on any categories with too many images. The performance hit shouldn't be significant enough to cause any problems on just a few hundred or so though.

$imgview = array();
$imageviews = $DB_site->query("SELECT catid, views FROM adv_gallery_images WHERE catid IN(Your catids here)");
while ($imgviews = $DB_site->fetch_array($imageviews))
{
$imgview["$imgviews[catid]"] += $imgviews['views'];
}

That enough to get you started?
  Reply With Quote