I want to get this as a single object because I work with a JObject on the frontend.
I got an array at the moment but I am unsure how i should modify it so it returns a single object instead.
This is the code:
$contacts = array();
while ($row = mysqli_fetch_array($stmt))
{
$contact = array("ID" => $row['ProduktID'],
"Name" => $row['ProduktNamn'],
"Number" => $row['ProduktPris']);
array_push($contacts, $contact);
}
echo json_encode($contacts, JSON_PRETTY_PRINT);
And the goal is for it to look something like this with "results" as well so I can reach the whole thing:
