I have this below JsonArray
send from API, I want to save it to the database, but I can't get the data of the Array, always is a blank.
[{
"user": 7,
"states": true
}, {
"user": 13,
"states": true
}, {
"user": 10,
"states": false
}]
This is what I tried to get the JsonArray
if($_SERVER['REQUEST_METHOD']=='POST'){
$jsondata = json_decode(file_get_contents("php://input"),true);
$user= $jsondata['user'];
$status = $jsondata['states'];
$Query = "insert table(user,states,)
values ('$user','$status ')";
}
Thank You