HomeAudio/ajax/ajax_getcustomq.php

32 lines
876 B
PHP

<?php
require '../header.php';
$query = "SELECT songid FROM " . QUEUECONTENTSTABLE . " AS q LEFT JOIN " . SONGSTABLE . " AS s ON q.songid=s.id WHERE qid=:qid ORDER BY s.album, s.title";
$fields = array();
$fields[':qid'] = $_SESSION['queuetarget'];
$sth = $globaldbh->prepare($query);
$sth->execute($fields);
$data = array();
$data["customq"] = array();
while ( $row = $sth->fetch() ) {
$songid = $row['songid'];
$song = new Song($songid);
$curdata = array();
$curdata["id"] = $song->getID();
$curdata["arturl"] = $song->getArtFile(ARTURL);
$curdata["title"] = $song->getTitle(HTMLSAFE);
$curdata["artist"] = $song->getArtist(HTMLSAFE);
$curdata["album"] = $song->getAlbum(HTMLSAFE);
$curdata["year"] = $song->getYear(HTMLSAFE);
$data['customq'][] = $curdata;
}
header('Content-Type: application/json');
echo json_encode($data);
exit();
?>