summaryrefslogtreecommitdiff
path: root/music.php
diff options
context:
space:
mode:
Diffstat (limited to 'music.php')
-rw-r--r--music.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/music.php b/music.php
index 3d814c1..8dcf178 100644
--- a/music.php
+++ b/music.php
@@ -196,6 +196,34 @@ function fetch_album_by_id($uid) {
}
}
+function fetch_album_music_ranged($album_id, $from=0, $count=100) {
+ $sql = "SELECT music_id FROM " . Config::$tb_album_music . " WHERE album_id=" . $album_id . " ORDER BY id DESC LIMIT " . $from . ", " . $count ;;
+ $result = execute_sql($sql);
+ if($result == NULL || $result->num_rows == 0)
+ {
+ return null;
+ }
+ $arr = array();
+ while($row = mysqli_fetch_assoc($result)){
+ $id = $row['music_id'];
+ $music = fetch_music_by_id($id);
+ array_push($arr, $music);
+ }
+ return $arr;
+}
+
+function get_all_album_music_count($album_id) {
+ $sql = "SELECT COUNT(*) as count FROM " . Config::$tb_album_music . " WHERE album_id=" . $album_id;//. " ORDER BY id DESC LIMIT " . $from . ", " . $count ;;
+ $result = execute_sql($sql);
+ if($result == NULL || $result->num_rows == 0)
+ return null;
+ $row = mysqli_fetch_assoc($result);
+ if($row != null){
+ return $row['count'];
+ }
+ return 0;
+}
+
// 从第from个记录开始的count个
function fetch_range_music($from=0, $count=100) {
$sql = "SELECT id FROM " . Config::$tb_music . " ORDER BY time DESC LIMIT " . $from . ", " . $count ;