Parašė Kižas· 2010 Lap. 6 18:11:49
#2
openside("Uploader'iu TOP 15!");
$result = dbquery("SELECT user_name, user_id, count(user_id) AS downloads_count FROM ".$db_prefix."downloads
INNER JOIN ".$db_prefix."users ON download_author=user_id GROUP BY user_name ORDER BY downloads_count DESC LIMIT 15");
echo "<table width='100%' cellpadding='0' cellspacing='0'>";
if(dbrows($result)!=0){
while($data=dbarray($result)){
echo "<tr><td class='small2' align='left'> <img src='/images/star.gif'>
<a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' class='side'>$data[user_name]</a></td>
<td class='small2' align='right'>".$data['downloads_count']."</td></tr>";
}
} else echo "<tr><td align='center'>Nieko nera.</td></tr>";
echo "</table>";
Jei noresi kad veiktu reikia i pridetinius puslapius imest sita koda:
<?php
$result = dbquery("ALTER TABLE ".$db_prefix."downloads ADD download_status VARCHAR(10) NOT NULL DEFAULT 'active' AFTER download_count");
if ($result) {
echo "Kuriamas pirmasis laukas... Laukas Sukurtas<br><br>";
} else {
echo "Kuriamas pirmasis laukas... NEPAVYKO<br>";
echo mysql_error();
echo "<br><br>";
}
$result = dbquery("ALTER TABLE ".$db_prefix."downloads ADD download_author SMALLINT(5) NOT NULL AFTER download_status");
if ($result) {
echo "Kuriamas antrasis laukas... Laukas Sukurtas<br><br>";
} else {
echo "Kuriamas antrasis laukas... NEPAVYKO<br>";
echo mysql_error();
echo "<br><br>";
}
?>
closeside();
Šitoje vietoje :
INNER JOIN ".$db_prefix."users ON download_author=user_id GROUP BY user_name ORDER BY downloads_count DESC LIMIT 15")
Skaičių 15 gali keisti į savo norimą, priklausomai, kiek tu narių norėsi atvaizduoti:
pvz
INNER JOIN ".$db_prefix."users ON download_author=user_id GROUP BY user_name ORDER BY downloads_count DESC LIMIT 5")
Šiuo atveju atvaizduos TOP 5 narius
Redagavo Kižas· 2010 Lap. 6 18:11:59