Log in

View Full Version : Display how many posts


Dark_Angel2
11-02-2002, 09:12 PM
I am trying to find a way to display how many posts altogether there are on my forums but on a non PHP page. My page is shtml.

I have already got a script which allows you to display the latest posts and posters names from this site but I wondered if anyone has one that will do what I want or if they could modify the one I already have.

Thanks.

zajako
11-02-2002, 09:27 PM
here ya go straigt from the index.php file :P


// get total posts
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
$totalposts=number_format($countposts['posts']);

just put that right after you require global.php

also if you want to grab the threads count add this right under that

$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread');
$totalthreads=number_format($countthreads['threads']);


to show the total posts in your template, just use this in your template:
$totalposts

and for your threads if you wish to disply the total, its simiply:
$totalthreads

glad to help ya out :]

Dark_Angel2
11-03-2002, 02:15 PM
Thanks but I'm havinf trouble getting this to work it keeps giving me error messages. Anyone help further please?

Dean C
11-03-2002, 02:21 PM
What error messages are you getting?

Regards

- miSt

ryans
11-07-2002, 05:39 PM
I noticed the Total post doesn't match with the actual # of post since the beginning. Anyway to show that info? After pruning a few million posts mine says 400,000, but the actual post is like 2.5 million.

NTLDR
11-07-2002, 05:42 PM
Do a search details on how to do this have been posted before ;)

ryans
11-07-2002, 05:44 PM
I did, but i'll search more.

thanks!