
<?php

require ('../credentials.php');
$con=mysqli_connect(HOST, USERNAME, PASSWORD, DBNAME)or die("cannot connect"); 

// array for JSON response

   
if(isset($_REQUEST['token']))
{
    $token=$_POST['token'];
	 $matricno=$_POST['matricno'];
	 $who=$_POST['who'];
	 
    $sql ="UPDATE $who SET gcm_device_token= '$token' WHERE user_id= '$matricno'";   

  //$result = mysqli_query($con, $sql) or die("Error in Selecting " . mysqli_error($con));

    if ($con->query($sql) === TRUE) {
    echo "Token Update Success";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

   
}
mysqli_close($con);


?>
