In a scenario I need to know the count of recordset a query will return, which in codeigniter can be done by $query->num_rows() or $this->db->count_all_results(). Which one is better and what is the difference between these two?
In a scenario I need to know the count of recordset a query will
Share
With
num_rows()you first perform the query, and then you can check how many rows you got.count_all_results()on the other hand only gives you the number of rows your query would produce, but doesn’t give you the actual resultset.