typo
[mdref/mdref-pq] / pq / Result / fetchAllCols.md
1 # array pq\Result::fetchAllCols([int $col = 0])
2
3 Fetch all rows of a single column.
4
5 ## Params:
6
7 * Optional int $col = 0
8 The column name or index to fetch.
9
10 ## Returns:
11
12 * array, list of column values.
13
14 ## Throws:
15
16 * pq\Exception\InvalidArgumentException
17 * pq\Exception\BadMethodCallException
18 * pq\Exception\RuntimeException
19
20 ## Example:
21
22 <?php
23
24 /* Of the following result set:
25
26 id | name
27 ---|------
28 1 | ann
29 2 | barb
30 3 | john
31 4 | mike
32
33 */
34
35 $result->fetchAllCols(0); /* this call would fetch:
36 array(4) {
37 int(1),
38 int(2),
39 int(3),
40 int(4)
41 }
42 */
43
44 $result->fetchAllCols("name"); /* this call would fetch:
45 array(4) {
46 string(3) "ann",
47 string(4) "barb",
48 string(4) "john",
49 string(4) "mike"
50 }
51 */