title: Output from json_encode
body: <p>i will get a output -->json_encode from select statement, but doesn't work. My screen is blank, please help me.
  I work with xammp for Mac.</p>
  
  <pre><code>&lt;?php
  $servername = "localhost";
  $username = "root";
  $password = "";   
  try {
      $conn = new PDO("mysql:host=$servername;dbname=app", $username, $password);
      // set the PDO error mode to exception
      $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      echo "Connected successfully"; 
  }
  catch(PDOException $e)
      {
      echo "Connection failed: " . $e-&gt;getMessage();
       }   
      $stmt = $conn-&gt;prepare("SELECT Name,Adresse,Latitude,Longi from Location"); 
      $stmt-&gt;execute();
      $row = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);
      //var_dump($row);
          // If so, then create a results array and a temporary one
          // to hold the data
          $resultArray = array();
          $tempArray = array();
  
          // Add each row into our results array
          $tempArray = $row;
          array_push($resultArray, $tempArray);
  
      // Finally, encode the array to JSON and output the results
  
      echo json_encode($tempArray,true);
  
  
  $conn = null;
  ?&gt;
  </code></pre>