<?php

    header("Access-Control-Allow-Origin: *");
    header("Content-Type: application/json");
    header("Accept: application/json");

    require '../config/conn.php';

    $uId = $_POST['uId'];
    $avatar = $_POST['avatar'];

    $updateUserName = "UPDATE `users` SET `avatar` = '$avatar' WHERE `uId` = '$uId'";
    $update = mysqli_query($conn,$updateUserName);

    if($update)
    {
        $response['statusCode'] = 0;
        $response['message'] = "Successful";
    }
    else
    {
        $response['statusCode'] = 4;
        $response['message'] = "Error occurred in updating user data";
    }

    echo json_encode($response);


?>