summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--user_guide_src/source/changelog.rst2
-rw-r--r--user_guide_src/source/database/query_builder.rst13
2 files changed, 8 insertions, 7 deletions
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 7f6cafa95..44a58915b 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -192,7 +192,7 @@ Release Date: Not Released
- Methods ``insert_batch()`` and ``update_batch()`` now return an integer representing the number of rows affected by them.
- Methods ``where()``, ``or_where()``, ``having()`` and ``or_having()`` now convert trailing ``=`` and ``<>``, ``!=`` SQL operators to ``IS NULL`` and ``IS NOT NULL`` respectively when the supplied comparison value is ``NULL``.
- Added method chaining support to ``reset_query()``, ``start_cache()``, ``stop_cache()`` and ``flush_cache()``.
- - Added an optional second to ``count_all_results()`` to disable resetting of QB values.
+ - Added an optional second parameter to ``count_all_results()`` to disable resetting of QB values.
- :doc:`Database Results <database/results>` changes include:
diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst
index 68ddca717..0a6d98744 100644
--- a/user_guide_src/source/database/query_builder.rst
+++ b/user_guide_src/source/database/query_builder.rst
@@ -520,18 +520,18 @@ The second parameter lets you set a result offset.
Permits you to determine the number of rows in a particular Active
Record query. Queries will accept Query Builder restrictors such as
-where(), or_where(), like(), or_like(), etc. Example::
+``where()``, ``or_where()``, ``like()``, ``or_like()``, etc. Example::
echo $this->db->count_all_results('my_table'); // Produces an integer, like 25
$this->db->like('title', 'match');
$this->db->from('my_table');
echo $this->db->count_all_results(); // Produces an integer, like 17
-The second paramater is to disable resetting of QB values. Example::
+However, this method also resets any field values that you may have passed
+to ``select()``. If you need to keep them, you can pass ``FALSE`` as the
+second parameter::
- echo $this->db->count_all_results('my_table'); // Produces an integer, like 25
- $this->db->like('title', 'match');
- echo $this->db->count_all_results(); // Produces an integer, like 17
+ echo $this->db->count_all_results('my_table', FALSE);
**$this->db->count_all()**
@@ -1097,9 +1097,10 @@ Class Reference
Prepends a database prefix, if one exists in configuration.
- .. php:method:: count_all_results([$table = ''])
+ .. php:method:: count_all_results([$table = '', [$reset = TRUE]])
:param string $table: Table name
+ :param bool $reset: Whether to reset values for SELECTs
:returns: Number of rows in the query result
:rtype: int