From d3b5f2f3f814f0342094b60614af10ec7b9d82b2 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sun, 5 Nov 2006 09:59:50 +0000 Subject: more work towards the democratic play stuff, really need a UI to test from here on out --- lib/class/playlist.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/class/playlist.class.php') 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(); -- cgit