3

When i run this code it's working fine

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

After this line

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

I'm Gating this error

<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 />

This is my code

<?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){

           }
     }


    ?>

What's the problem please help

0

1 Answer 1

2

You're checking the wrong variable. See Call to undefined method CI_DB_mysql_driver::num_rows()

$rs = $selectRecords->get('applicants');
echo $str = $this->db->last_query(); 

if($rs->num_rows()>0){

}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.