title: JSON output from MySQL works, but then white screen appears?
body: <p>I've used the below code to generate JSON from a MySQL table. It works great when I'm only generating 2 arrays, but for some reason when I try and generate 3 or 4 arrays, I get the "white screen of death". I thought it was happening because I needed to bump up my PHP Memory Limit, but I've done that and still get the same problem. See below:</p>
  
  <p><strong>The code that works is:</strong></p>
  
  <pre><code>&lt;?php
      //Create Database connection
      $db = mysql_connect("localhost","user","dbpassword");
      if (!$db) {
          die('Could not connect to db: ' . mysql_error());
      }
  
      //Select the Database
      mysql_select_db("dbname",$db);
  
      //Replace * in the query with the column names.
      $result = mysql_query("select * from customer", $db);  
  
      //Create an array
      $json_response = array();
  
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
          $row_array['customerfname'] = $row['customerfname'];
          $row_array['customerlname'] = $row['customerlname'];
  
          //push the values in the array
          array_push($json_response,$row_array);
      }
      echo json_encode($json_response);
  
      //Close the database connection
      fclose($db);
  
  ?&gt;
  </code></pre>
  
  <p><strong>But when I attempt to call more values, this is where I get the blank screen:</strong></p>
  
  <pre><code>&lt;?php
      //Create Database connection
      $db = mysql_connect("localhost","user","dbpassword");
      if (!$db) {
          die('Could not connect to db: ' . mysql_error());
      }
  
      //Select the Database
      mysql_select_db("dbname",$db);
  
      //Replace * in the query with the column names.
      $result = mysql_query("select * from customer", $db);  
  
      //Create an array
      $json_response = array();
  
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
          $row_array['customerfname'] = $row['customerfname'];
          $row_array['customerlname'] = $row['customerlname'];
          $row_array['customeremail'] = $row['customeremail'];
          $row_array['customertel'] = $row['customertel'];
  
          //push the values in the array
          array_push($json_response,$row_array);
      }
  
     var_dump($json_response);
  
     echo json_encode($json_response);
  
  
  
  ?&gt;
  </code></pre>
  
  <p><strong>Update**</strong></p>
  
  <p>The error appears to be with my last line <em>(echo json_encode ($json_response);</em></p>
  
  <p>The following output is generated when I add <em>print_r($row)</em> before that last line.</p>
  
  <pre><code>Array ( [id] =&gt; 1 [customerfname] =&gt; First [customerlname] =&gt; Last [customeremail] =&gt; test@test.com [customerphone] =&gt; 000-000-0000
  </code></pre>
  
  <p><strong>Update 2</strong></p>
  
  <p>Adding <em>var_dump($json_response);</em> before the <em>echo json_encode</em> line results in the blank screen.</p>