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: i need the total number of pictures  (Read 3671 times)

0 Members and 1 Guest are viewing this topic.

Vermeer

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 21
i need the total number of pictures
« on: January 09, 2006, 05:07:33 pm »

Hi,
i need following:
i want a Webpage with nothing but the total number of the pictures of the gallery.
A simple sql statement and the output line for the number - but i can't php...
Who can help me?

Thanks
Vermeer
Logged

ecto

  • Supporter
  • Coppermine frequent poster
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 144
    • My very incomplete gallery
Re: i need the total number of pictures
« Reply #1 on: January 09, 2006, 05:33:50 pm »

No error checking or anything, but it's the simplest I could come up with if you want to fetch it from "outside" of Coppermine. Maybe you'd like to check out "CPMFetch" too, there's a dedicated board here.

Code: [Select]
<?php
mysql_connect
('localhost''username''password');
mysql_select_db('database-name');
$result mysql_query("SELECT COUNT(*) FROM cpg_pictures");
$row mysql_fetch_array($result);
echo 
"<html><body>".$row[0]."</body></html>";
?>

Logged

tantley

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 18
    • BayouMX
Re: i need the total number of pictures
« Reply #2 on: March 29, 2007, 05:39:08 pm »

Excellent bit of code...

Had to modify the query on line 4 to the current Coppermine table which was "cpg1410_pictures" instead of "cpg_pictures"....

Thanks!
Logged

tantley

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 18
    • BayouMX
Re: i need the total number of pictures
« Reply #3 on: March 29, 2007, 05:47:47 pm »

And used the "number_format" function to insert the comma into the value as per default US format...

Just put
Code: [Select]
number_format($row[0]) between the periods of the echo statement.

Logged
Pages: [1]   Go Up
 

Page created in 0.037 seconds with 20 queries.