Quote:
Originally Posted by ZomgStuff
Well I created my own page, /ban.php and I created a template for it.
The problem is, in the php file I have this
Code:
// Count the total bans
$totalbans = $db->query_first_slave("
SELECT COUNT(userid)
FROM userban
");
That counts how many bans there have been in the past, not active, but total.
I've run the query in phpmyadmin and it works fine and returns 45.
The problem comes when I'm using my template, I use this
Code:
Total Bans: $totalbans
and it doesn't display a number. What am I doing wrong?
Thanks in advance.
|
The code should be
Code:
// Count the total bans
$totalbans = $db->query_first_slave("
SELECT COUNT(userid) AS bans
FROM userban
");
The template should reference $totalbans[bans]
The method query_first_slave returns the first row as an array - even if there is only one element.