News:

CPG Release 1.6.29
During HTML5 upload, keep pseudo blank code 200 messages from triggering error condition
added Russian language
correct failure to use theme menu icons in album manager
minor vulnerabilities mitigation

Main Menu

Counting pics

Started by hama, June 08, 2005, 12:37:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hama

I count the pics of the gallery and display the number on the startpage of my website. It works fine with this short script:

<?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

Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

nol33t


...AND a.category NOT IN ( 9, 43)

hama


Yes, it works!

<?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)

Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

hama

Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

neeth

[