count all comments in one album ? count all comments in one album ?
 

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

count all comments in one album ?

Started by darkkiller, October 10, 2005, 10:58:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

darkkiller

How can i count with php all comments in one album ?

Nibbler

Please explain what you are trying to accomplish.

darkkiller

on my main website i give the last 3 albums out

<?php
$query 
"SELECT * FROM party31gallery_albums ORDER BY aid DESC LIMIT 3";
$result=mysql_query($query);
while (
$daten=mysql_fetch_array($resultMYSQL_ASSOC))
{
    
$datum substr($daten[title], -10);
    
$title substr($daten[title], 0, -10);


    echo 
"<tr>";
    echo 
"<td width=15% class=row2>$datum</td>";
    echo 
"<td width=45% class=row2><a href=http://party31.web.my-ct.de/party31/gallery/thumbnails.php?album=$daten[aid]><font color=#000000 size=2>$title</a></td>";
    echo 
"<td width=15% class=row2> </td>";
    echo 
"</tr>";
}
?>


and now i want to give the number of all comments in one album out.
But i dont know what the MySql command is ?

Nibbler

The statement would be

SELECT COUNT(msg_id) FROM party31gallery_comments AS c INNER JOIN party31gallery_pictures AS p ON p.pid = c.pid WHERE p.aid = n

n = the aid of the album in question.

darkkiller

and the whole code with output ?
i dont know how i can give out only the number of all comments...

Nibbler


$result = mysql_query("SELECT COUNT(msg_id) FROM party31gallery_comments AS c INNER JOIN party31gallery_pictures AS p ON p.pid = c.pid WHERE p.aid = n");
list($numcom) = mysql_fetch_row($result);
echo "There are $numcom comments in this here album mister";

darkkiller

and can i make a graphik which appears when the last comment was 15 minutes ago post. ?
How ?
mhm.. if not .. can i give out the date of the last comment ?


THANK YOU VERY MUCH YOU ARE MY HERO FOR TODAY :):):)