My page tell me:
Notice: Undefined index
for all my variables. I'm a beginner in PHP and I tried with isset
but it didn't work. Can you tell me how I can fix this? Here is my code:
<?php
function encode_for_google_map($dbrow) {
$result = array (
'id' => $dbrow['id'],
'picture' => $dbrow['picture'],
'name' => $dbrow['name'],
'category' => $dbrow['category'],
'address' => $dbrow['address'],
'about' => $dbrow['about'],
'location' =>
array (
'latitude' => $dbrow['latitude'],
'longitude' => $dbrow['longitude'],
),
);
var_export(json_encode($result));
}
$db = mysqli_connect("localhost", "root", "", "parisdb");
$reponse = $db->query('SELECT * FROM paristable');
while ($donnees = $reponse->fetch_assoc()){
$data[]= $donnees;
$encode_donnees = encode_for_google_map($data);
}
echo $encode_donnees;
?>