| ADOdb Library for PHP Manual | ||
|---|---|---|
| Prev | GetAssoc | Next |
Returns an associative array for the recordset. If the number of columns returned is greater to two, a 2-dimensional array is returned, with the first column of the recordset becomes the keys to the rest of the rows. If the columns is equal to two, a 1-dimensional array is created, where the the keys directly map to the values (unless $force_array is set to true, when an array is created for each value).
Example:
We have the following data in a recordset:
row1: Apple, Fruit, Edible
row2: Cactus, Plant, Inedible
row3: Rose, Flower, Edible
GetAssoc will generate the following associative array:
Apple => [Fruit, Edible]
Cactus => [Plant, Inedible]
Rose => [Flower,Edible]
Returns:
The associative array, or false if an error occurs.
| Prev | Home | Next |
| GetRows | Up | Move |