-
Notifications
You must be signed in to change notification settings - Fork 0
/
tab_bannerartists.php
30 lines (26 loc) · 1.5 KB
/
tab_bannerartists.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<div style="text-align: center;">
<h1 class="arcade">Site Reports & Statistics:</h1>
<h2 class="arcade" style="color: #FF4F00;">Top 50 Art Contributors</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="2" align="center" id="listtable">
<tr>
<td class="head">User Name</td>
<td class="head">Total Art Submitted</td>
<td class="head">Ratings</td>
<td class="head">Average Rating</td>
</tr>
<?php ## Display series
$count = 0;
$query = "SELECT id, username, (SELECT COUNT(*) FROM banners WHERE userid=users.id) AS bannercount, (SELECT AVG(ratings.rating) FROM ratings,banners WHERE ratings.itemid=banners.id AND ratings.itemtype='banner' AND banners.userid=users.id) AS rating, (SELECT count(ratings.rating) FROM ratings,banners WHERE ratings.itemid=banners.id AND ratings.itemtype='banner' AND banners.userid=users.id) AS ratingcount FROM users ORDER BY bannercount DESC LIMIT 50";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
while ($db = mysql_fetch_object($result)) {
if ($class == 'odd') { $class = 'even'; } else { $class = 'odd'; }
print "<tr><td class=\"$class\"><a href=\"/?tab=artistbanners&id=$db->id\">$db->username</a></td><td class=\"$class\">$db->bannercount</td><td class=\"$class\">$db->ratingcount</td><td class=\"$class\">$db->rating</td></tr>\n";
$count++;
}
## No matches found?
if ($count == 0) {
print "<tr><td class=odd colspan=2>No banner artists found</td></tr>\n";
}
?>
</table>
</div>