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

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

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.