coppermine-gallery.com/forum

Support => Older/other versions => cpg1.3.x Support => Topic started by: neeth on June 28, 2005, 03:00:54 AM

Title: litle help with top10
Post by: neeth on June 28, 2005, 03:00:54 AM
there is code from nibbler for my top uploaders

   case 'uploaders' :
      starttable("60%", "Top uploaders",2);
      
      $result = db_query("SELECT user_name, user_id, group_name, COUNT(*) AS numpics FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_USERS']}, {$CONFIG['TABLE_USERGROUPS']} WHERE user_id = owner_id AND user_group = group_id AND group_id !='1' GROUP BY owner_id ORDER BY numpics DESC LIMIT 100");

      while ($row = mysql_fetch_assoc($result)){
         echo "<tr><td class=\"tableb\" >" . $i++ . ") <a href=\"profile.php?uid={$row['user_id']}\">{$row['user_name']} - {$row['group_name']}</a></td><td class=\"tableb\"><a href=\"thumbnails.php?album=lastupby&uid={$row['user_id']}\">{$row['numpics']}  Uploads </a></td></tr>";
      }

      endtable();
      break;

and how to edit that this code show how many user upload pics but from one album, ex album "20"

mod work on http://www.neeth.info/galerija/anycontent.php?table=uploaders

tnx for any help ...

NeMo
Title: Re: litle help with top10
Post by: kegobeer on June 28, 2005, 03:04:36 AM
WHERE user_id = owner_id AND user_group = group_id AND group_id !='1' and aid='20'

should do the trick.
Title: Re: litle help with top10
Post by: neeth on June 28, 2005, 03:57:22 AM
thnx man for you fast and great reply ;)
Title: Re: litle help with top10
Post by: neeth on June 28, 2005, 12:42:47 PM
aid is for album, what is for caegories ?

tnx
Title: Re: litle help with top10
Post by: kegobeer on June 28, 2005, 12:57:24 PM
That means changing the query a lot more.  Categories aren't stored in the pictures table, you have to query the albums and categories tables, looking for albums that are assigned to a certain category.


      $result = db_query("SELECT user_name, user_id, group_name, COUNT(*) AS numpics FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_USERS']}, {$CONFIG['TABLE_USERGROUPS']}, {$CONFIG['TABLE_CATEGORIES]}, {$CONFIG['TABLE_ALBUMS']} WHERE user_id = owner_id AND user_group = group_id AND group_id !='1' AND category='2' GROUP BY owner_id ORDER BY numpics DESC LIMIT 100");



I don't know if that will work.  You may need to have two separate queries, one to grab all the albums that are in a certain category, then another to pull the images and data.