@@ -12,7 +12,8 @@ There are several ways to generate query results:
12
12
Result Arrays
13
13
*************
14
14
15
- **getResult() **
15
+ getResult()
16
+ ===========
16
17
17
18
This method returns the query result as an array of **objects **, or
18
19
**an empty array ** on failure. Typically you'll use this in a foreach
@@ -36,7 +37,8 @@ instantiate for each result object
36
37
37
38
The above method is an alias of ``getCustomResultObject() ``.
38
39
39
- **getResultArray() **
40
+ getResultArray()
41
+ ================
40
42
41
43
This method returns the query result as a pure array, or an empty
42
44
array when no result is produced. Typically you'll use this in a foreach
@@ -48,7 +50,8 @@ loop, like this:
48
50
Result Rows
49
51
***********
50
52
51
- **getRow() **
53
+ getRow()
54
+ ========
52
55
53
56
This method returns a single result row. If your query has more than
54
57
one row, it returns only the first row. The result is returned as an
@@ -66,7 +69,8 @@ to instantiate the row with:
66
69
67
70
.. literalinclude :: results/007.php
68
71
69
- **getRowArray() **
72
+ getRowArray()
73
+ =============
70
74
71
75
Identical to the above ``row() `` method, except it returns an array.
72
76
Example:
@@ -98,7 +102,8 @@ parameter:
98
102
(prefetching). Use ``getUnbufferedRow() `` for processing large
99
103
result sets.
100
104
101
- **getUnbufferedRow() **
105
+ getUnbufferedRow()
106
+ ==================
102
107
103
108
This method returns a single result row without prefetching the whole
104
109
result in memory as ``row() `` does. If your query has more than one row,
@@ -145,7 +150,8 @@ In addition to the two methods listed below, the following methods also can
145
150
take a class name to return the results as: ``getFirstRow() ``, ``getLastRow() ``,
146
151
``getNextRow() ``, and ``getPreviousRow() ``.
147
152
148
- **getCustomResultObject() **
153
+ getCustomResultObject()
154
+ =======================
149
155
150
156
Returns the entire result set as an array of instances of the class requested.
151
157
The only parameter is the name of the class to instantiate.
@@ -154,7 +160,8 @@ Example:
154
160
155
161
.. literalinclude :: results/014.php
156
162
157
- **getCustomRowObject() **
163
+ getCustomRowObject()
164
+ ====================
158
165
159
166
Returns a single row from your query results. The first parameter is the row
160
167
number of the results. The second parameter is the class name to instantiate.
@@ -173,21 +180,24 @@ Example:
173
180
Result Helper Methods
174
181
*********************
175
182
176
- **getFieldCount() **
183
+ getFieldCount()
184
+ ===============
177
185
178
186
The number of FIELDS (columns) returned by the query. Make sure to call
179
187
the method using your query result object:
180
188
181
189
.. literalinclude :: results/017.php
182
190
183
- **getFieldNames() **
191
+ getFieldNames()
192
+ ===============
184
193
185
194
Returns an array with the names of the FIELDS (columns) returned by the query.
186
195
Make sure to call the method using your query result object:
187
196
188
197
.. literalinclude :: results/018.php
189
198
190
- **getNumRows() **
199
+ getNumRows()
200
+ ============
191
201
192
202
The number of records returned by the query. Make sure to call
193
203
the method using your query result object:
@@ -198,7 +208,8 @@ the method using your query result object:
198
208
CodeIgniter will fetch and buffer the query result records internally and
199
209
return a count of the resulting record array, which can be inefficient.
200
210
201
- **freeResult() **
211
+ freeResult()
212
+ ============
202
213
203
214
It frees the memory associated with the result and deletes the result
204
215
resource ID. Normally PHP frees its memory automatically at the end of
@@ -210,7 +221,8 @@ Example:
210
221
211
222
.. literalinclude :: results/020.php
212
223
213
- **dataSeek() **
224
+ dataSeek()
225
+ ==========
214
226
215
227
This method sets the internal pointer for the next result row to be
216
228
fetched. It is only useful in combination with ``getUnbufferedRow() ``.
0 commit comments