num_rows() problem in the count_all_results |
Hi guys,
I use the count_all_result function, and if I set a non existent column name in WHERE clause, then throw an error. In the WHERE clause have dynamic column name, so incorrect column names may occur Code: $this->db->select('column_1'); Error: Call to a member function num_rows() on a non-object This is in the count_all_results function of DB_query_builder. Code: public function count_all_results($table = '', $reset = TRUE) Here is a possible solution, but I don't want to overwrite the CI code: Code: if(is_object($result)){ Is there any good solution for this? (02-06-2019, 07:35 PM)php_rocs Wrote: @CodeArt, This table can be dynamically expanded with columns by user. I check the exists columns before query, but if something yet it goes wrong, I would like to check the error for own error handling, and I don't want default num_rows error message. (02-07-2019, 08:22 AM)php_rocs Wrote: @CodeArt, Thanks, I using this, and works fine with simple get queries, but not work with count_all_result for the previously written reasons |
Welcome Guest, Not a member yet? Register Sign In |