@@ -6,7 +6,7 @@ There are several ways to generate query results:
6
6
7
7
.. contents ::
8
8
:local:
9
- :depth: 2
9
+ :depth: 3
10
10
11
11
*************
12
12
Result Arrays
@@ -16,26 +16,37 @@ getResult()
16
16
===========
17
17
18
18
This method returns the query result as an array of **objects **, or
19
- **an empty array ** on failure. Typically you'll use this in a foreach
19
+ **an empty array ** on failure.
20
+
21
+ Getting an Array of stdClass
22
+ ----------------------------
23
+
24
+ Typically you'll use this in a foreach
20
25
loop, like this:
21
26
22
27
.. literalinclude :: results/001.php
23
28
24
- The above method is an alias of ``getResultObject() ``.
29
+ The above method is an alias of :php:meth: `CodeIgniter\\ Database\\ BaseResult::getResultObject() `.
30
+
31
+ Getting an Array of Array
32
+ -------------------------
25
33
26
34
You can pass in the string 'array' if you wish to get your results
27
35
as an array of arrays:
28
36
29
37
.. literalinclude :: results/002.php
30
38
31
- The above usage is an alias of ``getResultArray() ``.
39
+ The above usage is an alias of `getResultArray() `_.
40
+
41
+ Getting an Array of Custom Object
42
+ ---------------------------------
32
43
33
44
You can also pass a string to ``getResult() `` which represents a class to
34
45
instantiate for each result object
35
46
36
47
.. literalinclude :: results/003.php
37
48
38
- The above method is an alias of `` getCustomResultObject() `` .
49
+ The above method is an alias of `getCustomResultObject() `_ .
39
50
40
51
getResultArray()
41
52
================
@@ -272,7 +283,7 @@ Class Reference
272
283
Returns the query results as an array of rows, where each
273
284
row is an object of type ``stdClass ``.
274
285
275
- Usage: see `Result Arrays `_.
286
+ Usage: see `Getting an Array of stdClass `_.
276
287
277
288
.. php :method :: getCustomResultObject($class_name)
278
289
0 commit comments