title: php returns invalid json
body: <p>The following php code returns an invalid json error not sure why</p>
  
  <pre><code>&lt;?php
  include("dbConnect.php");
  
  $sql = "SELECT QID, Question, Answer,CatID FROM Questions";
  
  
  $res = mysqli_query($con,$sql);
  
  $result = array();
  
  while($row = mysqli_fetch_array($res)){
  array_push($result,
  array('qid'=&gt;$row[0],
  'question'=&gt;$row[1],
  'answer'=&gt;$row[2],
  'catid'=&gt;$row[3]
  ));
  }
  
  echo json_encode(array("result"=&gt;$result));
  
  mysqli_close($con);
  </code></pre>
  
  <p>when I run the link to the php it returns this data:</p>
  
  <pre><code>{"result":[{"qid":"1","question":"Question 1","answer":"Answer 1","catid":"1"},{"qid":"2","question":"Question 2","answer":"Answer 2","catid":"2"},{"qid":"3","question":"Question 3","answer":"Answer 3","catid":"3"},{"qid":"4","question":"Question 4","answer":"Answer 4","catid":"1"},{"qid":"5","question":"Question 5","answer":"Answer 5","catid":"3"},{"qid":"6","question":"Question 6","answer":"Answer 6","catid":"3"}]} 
  </code></pre>
  
  <p>and I tried running the link to the php that returns the json data using this <a href="https://jsonformatter.curiousconcept.com/" rel="nofollow">json formatter website</a></p>
  
  <p>I get these errors:</p>
  
  <pre><code>Error:Invalid media type, expecting application/json.[Code 28, Structure 0]
  
  Error:Invalid encoding, expecting UTF-8, UTF-16 or UTF-32.[Code 29, Structure 0]
  
  Error:Strings should be wrapped in double quotes.[Code 17, Structure 114]
  
  Error:Invalid characters found.[Code 18, Structure 114]
  
  Error:Strings should be wrapped in double quotes.[Code 17, Structure 116]
  
  Error:Invalid characters found.[Code 18, Structure 116]
  </code></pre>
  
  <p>If I try copying the resulting json data I get a valid JSON format but when I try running it from the php link that is stored on my server I get the above errors</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p><a href="http://aamaa.comli.com/retrieve.php" rel="nofollow">link to php</a></p>