Staff Stats

Detox

Member
Jul 24, 2010
365
24
I'm trying to get to show the staff stats, how many bans they have made and how many handle cfh they've handled
I know I would to have to echo them out I believe to have a cleaner code but I need more help
Here is what I have so far

PHP:
<?php
                                $getUserInfo = mysql_query("SELECT * FROM `users` WHERE rank >=4 LIMIT 5");
                                while ($userInfo= mysql_fetch_assoc($getUserInfo))
                                     {
                                echo '

<div style="padding:5px;">
<strong><a href="##">' .$userInfo['username'] . '</a></strong> has banned <strong></strong> users and handled <strong>1</strong> call for help tickets.
<br/>
<hr>';
                                }
                                ?>

Image:
1rruro.png
 

Janzeer

Headmaster Of Hogwart's
Apr 30, 2012
522
47
PHP:
<?php
if (mysql_num_rows($userInfo) > 0)
{
$x = 1;
while ($staff = mysql_fetch_assoc($userInfo))
{
$bans = mysql_num_rows(mysql_query("SELECT * FROM `bans` WHERE `added_by` = '" . $staff['username'] . "'"));
$cfh = mysql_num_rows(mysql_query("SELECT * FROM moderation_tickets WHERE moderator_id = '" . $staff['id'] . "'"));
if ($x == 2)
$x = 1;
else
$x = 2;
{
echo '{userrname} has banned <strong>' . filter($bans) . '</strong> users and handled <strong>' .filter($cfh) .'</strong> call for help tickets.';
}
}
}

                                ?>
Doesn't this code work?
 

Detox

Member
Jul 24, 2010
365
24
PHP:
<?php
if (mysql_num_rows($userInfo) > 0)
{
$x = 1;
while ($staff = mysql_fetch_assoc($userInfo))
{
$bans = mysql_num_rows(mysql_query("SELECT * FROM `bans` WHERE `added_by` = '" . $staff['username'] . "'"));
$cfh = mysql_num_rows(mysql_query("SELECT * FROM moderation_tickets WHERE moderator_id = '" . $staff['id'] . "'"));
if ($x == 2)
$x = 1;
else
$x = 2;
{
echo '{userrname} has banned <strong>' . filter($bans) . '</strong> users and handled <strong>' .filter($cfh) .'</strong> call for help tickets.';
}
}
}

                                ?>
Doesn't this code work?
No it doesn't work this is what I get back.
1zudjd.png
 

Wickd

The first member of the Knights of the Pink Table
Jan 15, 2013
1,936
612
Code:
$Tickets = mysql_query("SELECT * FROM `moderation_tickets` WHERE `moderator_id` = '" . $Users['id'] . "'");
                                $TicketsCount = mysql_num_rows($Tickets);
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
Code:
$Tickets = mysql_query("SELECT * FROM `moderation_tickets` WHERE `moderator_id` = '" . $Users['id'] . "'");
                                $TicketsCount = mysql_num_rows($Tickets);
Those are for who answered calls for help?


Those 2 codes need to be combined!

user info is never declared so it won't work:
<?php
$getUserInfo = mysql_query("SELECT * FROM `users` WHERE rank >=4 LIMIT 5");
if (mysql_num_rows($userInfo) > 0)
{$x = 1;
while ($staff = mysql_fetch_assoc($userInfo))
{$bans = mysql_num_rows(mysql_query("SELECT * FROM `bans` WHERE `added_by` = '" . $staff['username'] . "'"));$cfh = mysql_num_rows(mysql_query("SELECT * FROM moderation_tickets WHERE moderator_id = '" . $staff['id'] . "'"));
if ($x == 2)$x = 1;
else$x = 2;
{
echo '{userrname} has banned <strong>' . filter($bans) . '</strong> users and handled <strong>' .filter($cfh) .'</strong> call for help tickets.';
}
}
}
?>


Try this code:
<?php
$getUserInfo = mysql_query("SELECT * FROM `users` WHERE rank >=4 LIMIT 5");
if (mysql_num_rows($userInfo) > 0)
{$x = 1;
while ($staff = mysql_fetch_assoc($userInfo))
{$bans = mysql_num_rows(mysql_query("SELECT * FROM `bans` WHERE `added_by` = '" . $staff['username'] . "'"));$cfh = mysql_num_rows(mysql_query("SELECT * FROM moderation_tickets WHERE moderator_id = '" . $staff['id'] . "'"));
if ($x == 2)$x = 1;
else$x = 2;
{
echo '{userrname} has banned <strong>' . filter($bans) . '</strong> users and handled <strong>' .filter($cfh) .'</strong> call for help tickets.';
}
}
}
?>
 

Users who are viewing this thread

Top