View Full Version : a little php question


Avatar
11-15-04, 04:30 PM
Hi there!
I have a code that returns results from sql database table (part of my forum database) my forum member count. So I have a forum members count on my main page. The thing is that the forum users database has a +1 additional anonymous user that must not be deleted (it counts for all the anonymous users logging in and wanting to register). The problem is that that php code retuns the member count and that additional anonymous user in the database, so I always see +1 additional user than I really have.

the code is this (not by my hand written, I don't know php)

if($forumname == 'phpBB2')
{
if($settings[0]) // Display member count?
{
$countusers = $DB->query_first("SELECT COUNT(*) AS users FROM " . $tableprefix . "users");
echo 'Foruma dalibnieki: ' . $countusers['users'] . '<br />';
}

how do I set that this code returns the countusers minus one value?

thanx in advance!!

Avatar
11-16-04, 10:40 AM
nevermind, I figured it out myself :p

($countusers['users']-1) :D

Kunax
11-16-04, 11:40 AM
hehe that was hard :)

Avatar
11-16-04, 11:50 AM
hey, I suck at math and know next to nothing of php ;)