title: PHP json_encode multidimensional associative array
body: <p>I've used php's <code>json_encode()</code> function many times, but for some reason I can't seem to find the problem here...</p>
  
  <p>Note: I've removed error checking for clarity purposes.</p>
  
  <p>//PHP</p>
  
  <pre><code>&lt;?php
  session_start();
  require 'global/query.php';
  $sql = "SELECT sfl,station,latitude,longitude,address,city FROM maps";
  $stmt = $pdo-&gt;prepare($sql);
  $stmt-&gt;execute();
  while($result = $stmt-&gt;fetch(PDO::FETCH_ASSOC)){
      $trows[] = $result;
  }
  echo json_encode($trows);
  ?&gt;
  </code></pre>
  
  <p>I'm using AJAX and am just <code>console.log()</code>-ing the output to print the response like so...</p>
  
  <p>//JS</p>
  
  <pre><code>var callback = {
      "projects": function(e){
          console.log(e.target.response);
      }
  };
  </code></pre>
  
  <p>In the console it prints a blank line with none of the data...</p>
  
  <hr>
  
  <p>Now if I <code>var_dump</code> the <code>$trows</code> the output in the console will print the data so I know my sql statement works just fine...</p>
  
  <p>//PHP</p>
  
  <pre><code>var_dump($trows);
  </code></pre>
  
  <p>//CONSOLE</p>
  
  <pre><code>array(522) {
    [0]=&gt;
    array(6) {
      ["sfl"]=&gt;
      string(1) "1"
      ["station"]=&gt;
      string(26) "COMPRESSOR STATION"
      ["latitude"]=&gt;
      string(2) "23"
      ["longitude"]=&gt;
      string(4) "-115"
      ["address"]=&gt;
      string(10) "Unnamed Rd"
      ["city"]=&gt;
      string(9) "blah"
    }
    [1]=&gt;
    array(6) {
      ["sfl"]=&gt;
      string(1) "2"
      ["station"]=&gt;
      string(17) "STA TERMINAL"
      ["latitude"]=&gt;
      string(2) "16"
      ["longitude"]=&gt;
      string(4) "-101"
      ["address"]=&gt;
      string(11) "15 Ranch Dr"
      ["city"]=&gt;
      string(8) "Blah Blah"
    },
  </code></pre>
  
  <p><strong>Questions:</strong> Why isn't my php's json_encode function working? I've used this exact code before and the output was fine. </p>