forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: hama on June 08, 2005, 12:37:09 am

Title: Counting pics
Post by: hama on June 08, 2005, 12:37:09 am
I count the pics of the gallery and display the number on the startpage of my website. It works fine with this short script:

Code: [Select]
<?php
// new Gallery DB
$_gallery = new db($_cfg['DB_SERVER'], $_cfg['DB_GALLERY_USER'], $_cfg['DB_GALLERY_PASS'], $_cfg['DB_GALLERY_NAME']);

// gallery_pics
$gallery_pics implode(''$_gallery->fetch_first('SELECT COUNT(*) FROM cpg130_pictures AS p, cpg130_albums AS a WHERE p.aid = a.aid AND a.category <> 9'));
?>

As you see I exclude cat 9 (it's a private album and I don't want to count it).

Now I'd like to exclude two cats but 9,43 gives "bad arguments", 9 AND 43 gives no errors but counts wrong.

Can someone help please.  ;)

... Thanks

Title: Re: Counting pics
Post by: nol33t on June 08, 2005, 12:40:59 am
Code: [Select]
...AND a.category NOT IN ( 9, 43)
Title: Re: Counting pics
Post by: hama on June 08, 2005, 01:08:19 am

Yes, it works!

Code: [Select]
<?php
$gallery_pics 
implode(''$_gallery->fetch_first('SELECT COUNT(*) FROM cpg130_pictures AS p, cpg130_albums AS a WHERE p.aid = a.aid AND a.category NOT IN ( 9, 43)'));
?>

Thanks a lot!  :D

--> "Lé Toph' de Tieum - NYC ou pas NYC...that is the question" --> nice gallery!  8)

Title: Re: Counting pics
Post by: hama on June 08, 2005, 01:09:12 am

--> solved

Title: Re: Counting pics
Post by: neeth on June 11, 2005, 03:28:01 am
nice