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

$sql = "UPDATE `music` SET `listens` = $listens 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();
?> 