I have two php pages that returns an json string, both are working perfect locally, but only one is returning data on the public site ? Already did an echo of the sql query and execute (phpMyAdmin) it on the remote database and this is working. I can't find the problem, or to debug this. So and sugestions.
Working page Public and locally
<?php
require_once '../inc/dbconfig.php';
$sql_query = "SELECT keyword FROM images_keywords
ORDER BY keyword";
$json_data=array();//create the array
$result_set=mysqli_query($con,$sql_query);
while($row=mysqli_fetch_row($result_set))
{
$json_array['keyword']=urldecode($row['0']);
array_push($json_data,$json_array);
}
header('Content-Type: application/json');
echo json_encode($json_data);
?>
Only working on locally website
<?php
require_once '../inc/dbconfig.php';
$sql_query = "SELECT location FROM images_locations
ORDER BY location";
$json_data=array();//create the array
$result_set=mysqli_query($con,$sql_query);
while($row=mysqli_fetch_row($result_set))
{
$json_array['location']=urldecode($row['0']);
array_push($json_data,$json_array);
}
header('Content-Type: application/json');
echo json_encode($json_data);
?>
Aucun commentaire:
Enregistrer un commentaire