dakata__92
Super Moderator
PHP:
<?php
$n = 1;
$q = mysql_query ('SELECT u.username, SUM(v.views) AS views FROM videos v INNER JOIN users u ON u.user_id = v.user_id GROUP BY v.user_id ORDER BY v.views DESC 5') or die(mysql_error());
while($ru = mysql_fetch_array($q))
{
$qu = mysql_query("SELECT * FROM users WHERE id = '".$ru['user_id']."'");
$r = mysql_fetch_array($qu);
?>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="10%" align="center"><big><b><?php echo $n++ ?></b></big></td>
<td width="5%" class="music_video" style="float: none;"><a href="index.php?p=profile&id=<?php echo $ru['id'] ?>" title="<?php echo $r['username'] ?>"><img src="<?php echo $r['avatar'] ?>" width="80" height="60" style="margin: 0;" /></a></td>
<td width="50%"><a href="index.php?p=profile&id=<?php echo $ru['id'] ?>"><b><?php echo $r['username'] ?></b></a></td>
<td width="15%" align="center"><big><b><?php echo $r['views'] ?></b></big><br />гледания общо</td>
</tr>
</table>
<div class="line"></div>
<?php
}
?>