title: MySQL, PHP passing ORDER BY parameter
body: <p>I am using <a href="http://jtable.org" rel="nofollow">jTable</a> and am attempting to sort records.</p>
  
  <p>Currently the 'jtSorting' jTable variable is being passed correctly to my PHP script via the GET variable.  I am calling a MySQL stored procedure like so:</p>
  
  <pre><code>$res = $mysqli-&gt;query("CALL getReadReportsPaging($startIndex, $pageSize, '$sorting');");
  </code></pre>
  
  <p>The query returns records and does not give an error, but does not return the records sorted by specified field.  Records always return by Primary ID ASC.</p>
  
  <p>Here is the Stored Procedure:</p>
  
  <pre><code>DELIMITER $$
  
  CREATE DEFINER=`root`@`localhost` PROCEDURE `getReadReportsPaging`(startIndex INTEGER, pageSize INTEGER, sorting VARCHAR(255))
  BEGIN
      SELECT * FROM reports 
      WHERE `new`=0
      ORDER BY sorting
      LIMIT startIndex, pageSize;
  END
  </code></pre>
  
  <p>I tried calling the Procedure and passing in a column name with ASC or DESC like so:</p>
  
  <pre><code>call getReadReportsPaging(
      0,
      10,
      'ReportingName DESC'
  );
  </code></pre>
  
  <p>Which also returns records with Primary ID ASC.</p>
  
  <p>Any assistance appreciated.</p>