From 246c321617b18035725b3d42c6a313386687cedc Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sun, 5 Aug 2007 22:39:53 +0000 Subject: fixed some typos, minor bugs, updated the sql, added playlist as a browse type --- lib/album.lib.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/album.lib.php') diff --git a/lib/album.lib.php b/lib/album.lib.php index 8812cb4c..e04d494c 100644 --- a/lib/album.lib.php +++ b/lib/album.lib.php @@ -90,6 +90,14 @@ function get_image_from_source($data) { * this is used by the index to return some 'potential' albums to play */ function get_random_albums($count=6) { + + // Make sure that we have anything to pick from + $sql = "SELECT `id` FROM `album` LIMIT 7"; + $db_results = Dba::query($sql); + + $rows = Dba::num_rows($db_results); + if ($rows < 7) { return false; } + // There's a slight chance with this logic that the number of albums // returned will be less than the number requested if the id's for the // albums have signifigant gaps, but the speed increase is probably -- cgit