Trying to create a json encode with a ID and a image URL so i can reach it as a jobject in my frontend.
I am not working with a MySQL here as I store the images on my map/file manager.
I want it to look like this when when the code runs:
{
results: [
{
ID: "3",
URL: "http://www.image.com/Images/image3.jpg"
} ]
}
So I want to connect an image to a certain IP and also get its URL.
This is my code so far:
<?php
$contacts = array();
$contact = array("URL" => $row ['http://www.image.com/Images/image1.jpg'],
$row ['http://www.image.com/Images/image2.jpg'],
$row ['http://www.image.com/Images/image3.jpg'],
"ID" => $row ['1'], $row ['2'], $row ['3']);
array_push($contacts, $contact);
echo json_encode(array('results' => $contacts), JSON_PRETTY_PRINT);
?>