summaryrefslogtreecommitdiffstats
path: root/lib/class/playlist.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/class/playlist.class.php')
-rw-r--r--lib/class/playlist.class.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php
index 866e8ba8..af4962c9 100644
--- a/lib/class/playlist.class.php
+++ b/lib/class/playlist.class.php
@@ -159,12 +159,16 @@ class Playlist {
/**
* get_random_songs
* This returns all of the songs in a random order, except those
- * pulled from dyn_songs
+ * pulled from dyn_songs, takes an optional limit
*/
- function get_random_songs() {
+ function get_random_songs($limit='') {
+
+ if ($limit) {
+ $limit_sql = "LIMIT " . intval($limit);
+ }
$sql = "SELECT * FROM playlist_data WHERE playlist='" . sql_escape($this->id) . "'" .
- " ORDER BY RAND()";
+ " ORDER BY RAND() $limit_sql";
$db_results = mysql_query($sql, dbh());
$results = array();