Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Counting pics  (Read 3147 times)

0 Members and 1 Guest are viewing this topic.

hama

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Counting pics
« 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

« Last Edit: June 08, 2005, 01:13:03 am by kegobeer »
Logged
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

nol33t

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 244
  • Exploring Coppermine in every directions
    • tieum's pics
Re: Counting pics
« Reply #1 on: June 08, 2005, 12:40:59 am »

Code: [Select]
...AND a.category NOT IN ( 9, 43)

hama

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Re: Counting pics
« Reply #2 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)

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

hama

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Re: Counting pics
« Reply #3 on: June 08, 2005, 01:09:12 am »


--> solved

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

neeth

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 131
  • I love my gallery
    • Gelipo
Re: Counting pics
« Reply #4 on: June 11, 2005, 03:28:01 am »

nice
Logged
[
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 20 queries.