Browse Source

rss update: Get last 20 torrents, and order them ascending

ElectraHeart 7 years ago
parent
commit
1be4455af7
1 changed files with 12 additions and 10 deletions
  1. 12
    10
      classes/feed.class.php

+ 12
- 10
classes/feed.class.php View File

@@ -49,17 +49,19 @@ class FEED {
49 49
     if (!$Entries) {
50 50
  		require(SERVER_ROOT.'/classes/mysql.class.php');
51 51
 		$DB = NEW DB_MYSQL; //Load the database wrapper
52
-		
53 52
 		$DB->query("
54
-			SELECT t.*,
55
-				(SELECT Name from artists_group ag WHERE ag.ArtistID=ta.ArtistID) AS ArtistName,
56
-			    tg.Name AS GroupName,
57
-				tg.WikiBody AS WikiBody
58
-			FROM `torrents` t
59
-			LEFT JOIN torrents_artists ta ON t.GroupID=ta.GroupID
60
-			LEFT JOIN torrents_group tg ON tg.ID=ta.GroupID
61
-			ORDER BY ID DESC
62
-			LIMIT 50");
53
+			SELECT * FROM (
54
+				SELECT t.*,
55
+					(SELECT Name from artists_group ag WHERE ag.ArtistID=ta.ArtistID) AS ArtistName,
56
+				    tg.Name AS GroupName,
57
+					tg.WikiBody AS WikiBody
58
+				FROM `torrents` t
59
+				LEFT JOIN torrents_artists ta ON t.GroupID=ta.GroupID
60
+				LEFT JOIN torrents_group tg ON tg.ID=ta.GroupID
61
+				ORDER BY id DESC
62
+				LIMIT 20
63
+			) sub
64
+			ORDER BY id ASC");
63 65
 		while ($torrent = $DB->next_record()) {
64 66
 			$Title = $torrent['ArtistName'].' - '.$torrent['GroupName'].' - '.$torrent['Recorded'].' | '.$torrent['Codec'].' / '.$torrent['Media'].' / '.$torrent['Container'].' / '.$torrent['Resolution'].' / '.$torrent['AudioFormat'];
65 67
 			

Loading…
Cancel
Save