forum.coppermine-gallery.net
Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Vermeer 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
-
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>";
?>
-
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!
-
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.