title: PDO not calling the order of a row
body: <p>I have tried to make this work but it adds up all the rows not just 5 like I am trying to in the query</p>
  
  <pre><code>$username = $_SESSION['username'];
  $stmt = $db-&gt;prepare("
  select sum(correct) from exams where 
  username = :username ORDER BY :testID DESC LIMIT :5");
  </code></pre>
  
  <p>Due to the problems with not being able to callthe last 5 rows I am unable to test the ordering string.</p>
  
  <p>I have read questions similar to this on stackoverflow but still cant seem to get it right. maybe there are other problems with my code but I can always add that if requsted :)</p>
  
  <p>the full code</p>
  
  <pre><code>   &lt;?php
  
  require('includes/config.php'); 
  
  //if not logged in redirect to login page
  if(!$user-&gt;is_logged_in()){ header('Location: login.php'); } 
  $username = $_SESSION['username'];
  $last5rate = $db-&gt;prepare("select sum(correct) from exams where username = :username ORDER BY :testID DESC LIMIT 5");
  $last5rate-&gt;execute(array(':username' =&gt; $username));
  for($i=0; $rows = $last5rate-&gt;fetch(); $i++){
      //Edit this row
  $last5  = $rows['sum(correct)'];
  $last5final = $last5 / 10;
   }
  echo $last5final;
  
  ?&gt;
  </code></pre>