i need the total number of pictures i need the total number of pictures
 

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

Main Menu

i need the total number of pictures

Started by Vermeer, January 09, 2006, 05:07:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Vermeer

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

ecto

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.


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


tantley

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!

tantley

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

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