My php server is generating two JSON output
1.] For MySql JSON printing I am using this code.
$sql = "select id ,Title , Meassage from lodhinews";
$result = $conn->query($sql);
$values = array();
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$values['data'][] = array(
'id'=>$row['id'],
'Title'=>$row['Title'],
'Meassage'=>$row['Meassage']
);
}
header('Content-Type: application/json;charset=utf-8');
echo json_encode($values ,JSON_PRETTY_PRINT);
} else {
$values = array(
'error'=>'No results found'
);
}
$conn->close();
?>
2.] For file name printing I am using this code
chdir('./uploads');
foreach(glob('*.*') as $filename){
$data[] = $filename;
}
echo json_encode($data);
?>
both the above code is working fine!
I wanted this both json output combined on one single page