<?php
 
include 'dataconfig.php' ;

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$id = urldecode($_POST['id']);

$sql = "SELECT * FROM `recent` WHERE `id` = $id ORDER BY id DESC";

$result = $conn->query($sql);

mysqli_query($conn,$sql); 

$response = array();

while($row = mysqli_fetch_array($result)){
    array_push($response,array(
        'music_id'=>$row['music_id'],
        'title'=>$row['title'],
        'album'=>$row['album'],
        'artist'=>$row['artist'],
        'image'=>$row['image'],
        'path'=>$row['path'],
        'genre'=>$row['genre']
    ));
}
echo json_encode(array('result'=>$response));
$conn->close();
?>