2015-09-25 99 views
3

當我運行這段代碼它的正常工作笨NUM行錯誤

echo $str = $this->db->last_query(); 

此行

if($selectRecords->num_rows()>0){ 
//some action 
} 

後,我門控這個錯誤

<br /> 
<b>Fatal error</b>: Call to undefined method CI_DB_mysql_driver::num_rows() in <b>/vagrant/application/controllers/applicationtable.php</b> on line <b>1240</b><br /> 

這是我的代碼

<?php 
    public function xyz(){ 
      $selectRecords=$this->db->select(" (SELECT name FROM $this->reportTable WHERE id=$this->reportType) AS `$this->reportLabel`, 
         SUM(rashi_given) AS `total` , 
         SUM(rashi_accepted) AS atotal"); 
       $selectRecords->join('type', 'applicants.type=type.id', 'left'); 
       $selectRecords->group_by($this->reportType); 
       $selectRecords->get('applicants'); 
      echo $str = $this->db->last_query(); 
      if($selectRecords->num_rows()>0){ 

      } 
    } 


    ?> 

有什麼問題請幫忙

回答