Recent Topics

1 Feb 23, 2005 06:07    

I'm not too sharp with the SQL/PHP stuff so I was hoping someone could help me.. All I would like to know is how could I add up the total number of words in all my posts and then request the result on a page? I'd like to do the same thing for the number of posts and total number of comments but if I can get help figuring out the first one, I could figure out the other two on my own.

3 Feb 23, 2005 13:45

<?php 

if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );

$query = "SELECT SUM(post_wordcount) FROM $tableposts";
$post_word_total = $DB->get_var($query);
$post_word_total = number_format($post_word_total); ?>
<li><?php echo $post_word_total.' words'; ?></li>

That'll do a word count with the commas for where commas go in numbers. Save it as _blah.php in your skins/skinname folder then put

<ul>
<?php require( dirname(__FILE__).'/_blah.php'); ?>
</ul>

in your _main.php where you want your total word count showing up.

4 Feb 24, 2005 11:42

Thanks guys, I appreciate the help.


Form is loading...