I am trying to convert data from my DB to JSON with a PHP script. Everything works great on my local environment (MAMP). As soon as I am trying to put things together on my server, my JSON File is empty :(
What I have so far
my php script
<?php
$connection = mysqli_connect("localhost","root","root","angulardb") or die("Error " . mysqli_error($connection));
$sql = "select * from postings";
$result = mysqli_query($connection, $sql) or die("Error in Selecting " . mysqli_error($connection));
$emparray = array();
while($row =mysqli_fetch_assoc($result))
{
$emparray[] = $row;
}
$fp = fopen('menue.json', 'w');
fwrite($fp, json_encode($emparray));
fclose($fp);
echo json_encode($emparray);
?>
By uploading this script to my server (& update the data), I receive an empty JSON file with no response.
Any Idea what can be wrong??? Is there additional configuration necessary on the server side?
Thanks in advance