title: How can I load data from mySQL database via json_encode?
body: <p>I am loading data from my database via json.</p>
  
  <pre><code>$data = $db-&gt;query('SELECT * FROM data ORDER BY id ASC;')-&gt;fetchAll(PDO::FETCH_ASSOC);
  $json_string = json_encode($data);
  $file = 'data.json';
  file_put_contents($file, $json_string);
  </code></pre>
  
  <p>This means, when I load the data from the database my file <code>data.json</code> is updated.</p>
  
  <p>The data.json looks for example like this:</p>
  
  <pre><code>[{"id":"40","name":"Monkey","firstname":"Fred","company":"monkeys","street":"monkeystreet 23","plz":"11111","place":"Wonderland","email":"monkey@monkeyland.com","phone":"1111","fax":"1111","cell":"1111,"country":"Monkeyland","url":"","category":""}
  </code></pre>
  
  <p>This works very well on my localhost, but on my server, the file is not beeing updated. 
  This means, if I change, "Monkey" into "Bird", in my database it is "Bird" but in the json file it is still "Monkey".</p>
  
  <p>What could cause this problem? I am happy for any help! </p>