Firefox PHP

Stats- help needed!

Posted by Mandingo 
Stats- help needed!
June 25, 2004 09:43PM
I'm doing some basic stats for a site. I've got an idea to have a couple of simple messages saying -

1. There are 'x' registered users.

2. Our users have posted a total of 'x' messages.



So far, I've got a php script where I'm trying to count the total amount of registered users, with this -


mysql_select_db("$database");
$result = mysql_query("select count(*) as total from forum5_users");

while ($posts = mysql_fetch_array($result)) {

echo $users=count($total);

}
mysql_close($conn);
?>

I think I'm close to it, but it returns a number of 0. Any ideas where I'm going wrong?
I assume the technique for getting the total of all messages is similar?
Re: Stats- help needed!
June 25, 2004 10:20PM
> echo $users=count($total);

what for?

do this:
$row  = mysql_fetch_row($result);
$users= $row[0];

and you will have the number of users in $users.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Stats- help needed!
June 25, 2004 10:37PM
O.K. Thanks.
Sorry, only registered users may post in this forum.

Click here to login