title: ORDER BY date while also using LIMIT in a MySQL query - PHP
body: <p>HI, </p>
  
  <p>I can't quite figure this out, I'm trying to pull records from MySQL, order them reverse-chronologically and limit the results to four per page (and using pagination to organize the pages). It is currently returning this error: </p>
  
  <p>Fatal error: SQL in /Users/allan/Sites/4is_site/casestudylist.php on line 126</p>
  
  <pre><code>$limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
  $query = "SELECT * FROM studies  ORDER BY date desc WHERE niche = '{$_GET['niche']}' $limit";
  </code></pre>
  
  <p>The pagination has been working fine, just now that I've tried to add the ORDER BY that I'm getting problems.</p>