| ADOdb Library for PHP Manual | ||
|---|---|---|
| Prev | GetOne | Next |
Adds a bind parameter in a fashion that is compatible with Microsoft SQL Server and Oracle oci8. The parameters are:
Executes the SQL and returns the first field of the first row. The recordset
and remaining rows are discarded for you automatically. If an error occur, false
is returned; use ErrorNo() or ErrorMsg() to get the error details.
Since 4.96, we return null if no records were found.
Returns an associative array for the given query $sql with optional bind parameters in $inputarr. 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).
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 2-dimensional associative array:
Apple => array[Fruit, Edible]
Cactus => array[Plant, Inedible]
Rose => array[Flower,Edible]
If the dataset is:
row1: Apple,
Fruit
row2: Cactus, Plant
row3: Rose, Flower
GetAssoc will generate the following 1-dimensional associative array (with $force_array==false):
Apple => Fruit
Cactus=>Plant
Rose=>Flower
The function returns:
The associative array, or false if an error occurs.
Caching version of GetAssoc function above.
| Prev | Home | Next |
| Parameter | Up | CacheGetOne |