Skip to content

Commit b6fa847

Browse files
authored
Docs $reset in countAll countAllResult
Additional docs for countAll Correction for countAllResult (docs contained wrong calls which didn't meet what is in the code)
1 parent 178fb17 commit b6fa847

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

user_guide_src/source/database/query_builder.rst

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ system.
1717

1818
.. contents::
1919
:local:
20-
:depth: 1
20+
:depth: 2
2121

2222
*************************
2323
Loading the Query Builder
@@ -511,29 +511,34 @@ The second parameter lets you set a result offset.
511511

512512
$builder->limit(10, 20); // Produces: LIMIT 20, 10 (in MySQL. Other databases have slightly different syntax)
513513

514+
514515
**$builder->countAllResults()**
515516

516517
Permits you to determine the number of rows in a particular Query
517518
Builder query. Queries will accept Query Builder restrictors such as
518519
``where()``, ``orWhere()``, ``like()``, ``orLike()``, etc. Example::
519520

520-
echo $builder->countAllResults('my_table'); // Produces an integer, like 25
521+
echo $builder->countAllResults(); // Produces an integer, like 25
521522
$builder->like('title', 'match');
522523
$builder->from('my_table');
523524
echo $builder->countAllResults(); // Produces an integer, like 17
524525

525526
However, this method also resets any field values that you may have passed
526527
to ``select()``. If you need to keep them, you can pass ``FALSE`` as the
527-
second parameter::
528+
first parameter.
528529

529-
echo $builder->countAllResults('my_table', FALSE);
530+
echo $builder->countAllResults(false); // Produces an integer, like 17
530531

531532
**$builder->countAll()**
532533

533534
Permits you to determine the number of rows in a particular table.
534-
Submit the table name in the first parameter. Example::
535+
Example::
535536

536-
echo $builder->countAll('my_table'); // Produces an integer, like 25
537+
echo $builder->countAll(); // Produces an integer, like 25
538+
539+
As is in countAllResult method, this method resets any field values that you may have passed
540+
to ``select()`` as well. If you need to keep them, you can pass ``FALSE`` as the
541+
first parameter.
537542

538543
**************
539544
Query grouping
@@ -994,6 +999,15 @@ Class Reference
994999
Generates a platform-specific query string that counts
9951000
all records returned by an Query Builder query.
9961001

1002+
.. php:method:: countAll([$reset = TRUE])
1003+
1004+
:param bool $reset: Whether to reset values for SELECTs
1005+
:returns: Number of rows in the query result
1006+
:rtype: int
1007+
1008+
Generates a platform-specific query string that counts
1009+
all records returned by an Query Builder query.
1010+
9971011
.. php:method:: get([$limit = NULL[, $offset = NULL]])
9981012
9991013
:param int $limit: The LIMIT clause

0 commit comments

Comments
 (0)