title: MySQL/PHP Array to Javascript
body: <p>So I want to store all of my MySQL results in an array I can manipulate with javascript/jQuery.</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>&lt;?php
      $sql = "SELECT * FROM potentials";
      $result = mysql_query($sql) or die(mysql_error());
      $potential = mysql_fetch_array($result);
      echo json_encode($potential);
  ?&gt;
  </code></pre>
  
  <p>And my Javascript:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function(){
          var myArray = "&lt;?php print(json_encode($potential)); ?&gt;";
          console.log(myArray)
      )};
  &lt;/script&gt;
  </code></pre>
  
  <p>I keep getting "Unexpected number" or "unexpected identifier". Whats going on?</p>