title: Commands out of sync; you can't run this command now while calling stored procedure in Mysql
body: <p>I am trying to run a procedure i am getting this error</p>
  
  <pre><code>Commands out of sync; you can't run this command now
  </code></pre>
  
  <p>here is the original error that i get   </p>
  
  <p>Commands out of sync; you can't run this command now</p>
  
  <pre><code>SELECT DISTINCT `property_id`, `pin`, `block_id`, `serial_no`, `status`, `ex_sn`, `ex_code`, `property_date_time`, `street_add`, `lab_name` FROM `view_property_user_lab` WHERE status = '6' AND lab_id = '01' AND designation IN( '5','6') LIMIT 10 
  </code></pre>
  
  <p>can any 1 tell me why i am getting this error and how to get rid of it . I am using Code igniter and i also tried this </p>
  
  <pre><code>$query-&gt;free_result().
  </code></pre>
  
  <p>within my procedure i have used this statement </p>
  
  <pre><code>   SELECT *
     FROM
    temp_calculated_rates_and_rules;
   -- and then
     TRUNCATE temp_calculated_rates_and_rules;
  </code></pre>
  
  <p>as this thing is called in PHP Loop which is like this </p>
  
  <pre><code>  $arrIds = array('5','10');
      foreach ($arrIds as $id)
      {
          $this-&gt;_StoredProcedureMapper-&gt;setPId($id);
  
          $p10values = $this-&gt;_StoredProcedureMapper-&gt;fetch_p10_values();
          if (intval(@$p10values[0]['is_exempted']) != 1)
          {
              $this-&gt;generate_p10($p10values);
          }
  
      }
  </code></pre>
  
  <p>and here is mapper function</p>
  
  <pre><code>    function fetch_p1_values()
  {
  
      $qry = "CALL sp_main_pt10(?)";
      $result = $this-&gt;db-&gt;query($qry, $this-&gt;getPId());
      return $result-&gt;result_array();
  }
  </code></pre>
  
  <p>And i am using "mysqli" driver</p>