<?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']);
$likes = urldecode($_POST['likes']);

$sql = "UPDATE `music` SET `like` = $likes WHERE `music`.`id` = $id";

mysqli_query($conn,$sql); 
$result = $conn->query($sql);
    
if($result){
    
    echo "Like updated successfully";
    
    }else {
        echo "error updating like";
    }
    
$conn->close();
?> 