hip1/po/songplayer.php
<?php
$album_id = $_GET['album_id'];
$song_id = $_GET['song_id'];
include('../db.php');
if($song_id){
$query = "select * from songs where song_id = $song_id";
$result = mysqli_query($db, $query) or die(mysqli_error($db));
$row = mysqli_fetch_array($result);
echo '<iframe style="border-radius:12px" src="'.$row['spotify_url'].'" width="100%" height="152" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>';
}
else{
$query = "select * from songs where song_id = (select min(song_id) from songs where album_id = $album_id)";
$result = mysqli_query($db, $query) or die(mysqli_error($db));
$row = mysqli_fetch_array($result);
echo '<iframe style="border-radius:12px" src="'.$row['spotify_url'].'" width="100%" height="152" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>';
}
//https://open.spotify.com/embed/track/6MNT8Yz0peis2saHdUjIES
?>
Resultaat
Made by Thijs Aarnoudse