|
| Re: Lastest torrent ;D [message #2722 is a reply to message #2715] |
Mon, 08 June 2009 03:19   |
|
OpenTable("last 10 uploads");
$sql = "SELECT ".$db_prefix."_torrents.*, IF(".$db_prefix."_torrents.numratings < '".$minvotes."', NULL, ROUND(".$db_prefix."_torrents.ratingsum / ".$db_prefix."_torrents.numratings, 1)) AS rating, ".$db_prefix."_categories.name AS cat_name, ".$db_prefix."_categories.image AS cat_pic, U.username, IF(U.name IS NULL, U.username, U.name) as user_name, U.level as user_level FROM ".$db_prefix."_torrents LEFT JOIN ".$db_prefix."_categories ON category = ".$db_prefix."_categories.id LEFT JOIN ".$db_prefix."_users U ON ".$db_prefix."_torrents.owner = U.id WHERE banned = 'no' AND ".$db_prefix."_torrents.password IS NULL ORDER BY ".$db_prefix."_torrents.added DESC LIMIT 10;";
$res = $db->sql_query($sql) or btsqlerror($sql);
if ($db->sql_numrows($res) > 0) {
torrenttable($res,"usertorrent");
} else {
OpenTable2();
echo "<h3>"._btnotorrents."</h3>";
CloseTable2();
}
CloseTable();
|
|
|
|
|
| Re: Lastest torrent ;D [message #2901 is a reply to message #2729] |
Mon, 31 August 2009 23:20  |
|
$rq = "SELECT id, name FROM ".$db_prefix."_categories ORDER BY name";
$res1 = $db->sql_query($rq);
while ($row = $db->sql_fetchrow($res1))
{
extract ($row);
OpenTable("last 10 uploads From Category ".$name."");
$sql = "SELECT ".$db_prefix."_torrents.*, IF(".$db_prefix."_torrents.numratings < '".$minvotes."', NULL, ROUND(".$db_prefix."_torrents.ratingsum / ".$db_prefix."_torrents.numratings, 1)) AS rating, ".$db_prefix."_categories.name AS cat_name, ".$db_prefix."_categories.image AS cat_pic, U.username, IF(U.name IS NULL, U.username, U.name) as user_name, U.level as user_level FROM ".$db_prefix."_torrents LEFT JOIN ".$db_prefix."_categories ON category = ".$db_prefix."_categories.id LEFT JOIN ".$db_prefix."_users U ON ".$db_prefix."_torrents.owner = U.id WHERE ".$db_prefix."_torrents.category = '".$id."' AND banned = 'no' AND ".$db_prefix."_torrents.password IS NULL ORDER BY ".$db_prefix."_torrents.added DESC LIMIT 10;";
$res = $db->sql_query($sql) or btsqlerror($sql);
if ($db->sql_numrows($res) > 0) {
torrenttable($res,"usertorrent");
} else {
OpenTable2();
echo "<h3>"._btnotorrents."</h3>";
CloseTable2();
}
CloseTable();
}
$db->sql_freeresult($res1);
[Updated on: Thu, 10 September 2009 20:47] Report message to a moderator
|
|
|