title: Passing AngularJS variable to PHP/mySQL query
body: <p>I'm attempting to pass an AngularJS variable to a mysql query. I can't figure out why it won't work. Here is the code:</p>
  
  <pre><code>$test = "{{tvShows[whatShow].tvdb_id}}";
  
  $query = "SELECT * FROM tv_seasons WHERE EXISTS (SELECT tvdb_id FROM tv_episodes WHERE tv_episodes.tvdb_id=tv_seasons.tvdb_id AND tv_episodes.season=tv_seasons.season) AND tvdb_id = '";
  $query .= $test;
  $query .= "' ORDER BY CAST('episode' AS UNSIGNED INTEGER)";
  
  $results = mysql_query($query);
  
  while($row = mysql_fetch_array($results)){      
      print_r($row);
      echo "&lt;br&gt;";
  }
  </code></pre>
  
  <p><code>$test</code> echos properly and the query looks correct and when pasted into phpMyAdmin works as expected but when I try to do this it wont work for some reason. Any thoughts?</p>