Advanced search  

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]

Pages: [1]   Go Down

Author Topic: count all comments in one album ?  (Read 3375 times)

0 Members and 1 Guest are viewing this topic.

darkkiller

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
count all comments in one album ?
« on: October 10, 2005, 10:58:36 pm »

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

Nibbler

  • Guest
Re: count all comments in one album ?
« Reply #1 on: October 10, 2005, 10:59:38 pm »

Please explain what you are trying to accomplish.
Logged

darkkiller

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: count all comments in one album ?
« Reply #2 on: October 10, 2005, 11:02:04 pm »

on my main website i give the last 3 albums out

Code: [Select]
<?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 ?
Logged

Nibbler

  • Guest
Re: count all comments in one album ?
« Reply #3 on: October 10, 2005, 11:17:38 pm »

The statement would be

Code: [Select]
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.
Logged

darkkiller

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: count all comments in one album ?
« Reply #4 on: October 10, 2005, 11:27:25 pm »

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

Nibbler

  • Guest
Re: count all comments in one album ?
« Reply #5 on: October 10, 2005, 11:33:07 pm »

Code: [Select]
$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";
Logged

darkkiller

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: count all comments in one album ?
« Reply #6 on: October 10, 2005, 11:39:40 pm »

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 :):):)
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 15 queries.