PHP Selecting JSON Data

I’m having trouble selecting the “decoded_payload” part of the JSON file. I don’t think I’m referencing the right section of the code, as the reading doesn’t end up in my database.

<?php
$data = file_get_contents("php://input");

$json = json_decode($data, true);

   $decoded_payload = $json['decoded_payload'];
	$temp = $end_device_ids['temp'];

   $servername = "";
   $username = "";
   $password = "";
   $dbname = "";

   
   $conn = new mysqli($servername, $username, $password, $dbname);
  
   if ($conn->connect_error) {
      die("Connection failed: " . $conn->connect_error);
   }

   $sql = "INSERT INTO tbl_temp (temp)
   VALUES ('$temp')";

if ($conn->query($sql) === TRUE) {
      echo "New record created successfully";
   } else {
      echo "Error: " . $sql . " => " . $conn->error;
   }

   $conn->close();
?>

You can’t just go straight to fourth base without going via the other steps, JSON isn’t that sort of girl.

I’ve already given you the link to my template when you asked about Webhooks & JSON 21 days ago. No one likes to repeat themselves, so I’d strongly recommend that you use forum search & take notes, as we really hate giving the same answers over and over, additionally, we don’t much like is repeating ourselves.

PS, temp as any sort of entity name is likely to end up in disaster.