phpcodeigniterresultsetmysql-num-rows

Get number of returned rows from a CodeIgniter query


How can I SELECT some data from one of my tables and then count how many rows are returned using CodeIgniter?


Solution

  • Have a look at the result functions here:

    $this->db->from('yourtable');
    [... more active record code ...]
    $query = $this->db->get();
    $rowcount = $query->num_rows();