forked from TheGamesDB/TheGamesDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtab_bannerartists.php
38 lines (30 loc) · 1.7 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
31
32
33
34
35
36
37
38
<div id="gameHead">
<h1>Site Reports and Statistics</h1>
<div class="links" style="text-align: center;">
<p> </p>
<h2 style="color: #FF4F00;">Top 50 Art Contributors</h2>
<p> </p>
<table align="center" border="1" cellspacing="0" cellpadding="7">
<tr>
<th style="background-color: #333; color: #FFF;">User Name</th>
<th style="background-color: #333; color: #FFF;">Total Art Submitted</th>
<th style="background-color: #333; color: #FFF;">Ratings</th>
<th style="background-color: #333; color: #FFF;">Average Rating</th>
</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>
</div>