album sort order album sort order
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

album sort order

Started by ganeshcp, November 24, 2005, 10:32:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ganeshcp


I want to sort albums by their popularity but I don't think albums have a hits count. So I thought I can sort them by the no. of pics they contain by using

    $sql = 'SELECT a.aid, a.title, a.description, visibility, filepath, '.
           'filename, url_prefix, pwidth, pheight '.
           'FROM '.$CONFIG['TABLE_ALBUMS'].' as a '.
           'LEFT JOIN '.$CONFIG['TABLE_PICTURES'].' as p '.
           'ON a.thumb=p.pid '.
           'WHERE category='.$cat.$album_filter.
           ' ORDER BY a.pic_count DESC '.
           $limit;


the funny thing is when i brwse my db all the stats for albums are empty!

pic_count,  last_addition all are zeroes... :(


Nibbler

They are not used. If you want to do this then you need to adjust the query to count the actual number of hits or pics.