ADOdb is returning both column names and number indexes
ADOdb fetchRow
output:
Array
(
[0] => ABC
[NAME] => ABC
[1] => 33
[AGE] => 33
[3] => M
[GENDER] => M
[4] => LA
[CITY] => LA
[5] => OH
[STATE] => O开发者_JAVA技巧H
)
How can I get the number-index only output:
Array
(
[0] => ABC
[1] => 33
[2] => M
[3] => LA
[4] => OH
)
Or the name-index only output? :
Array
(
[NAME] => ABC
[AGE] => 33
[GENDER] => M
[CITY] => LA
[STATE] => OH
)
Numeric indexes – use $connection->SetFetchMode(ADODB_FETCH_NUM).
Associative indexes – the keys of the array are the names of the fields (in upper-case). Use $connection->SetFetchMode(ADODB_FETCH_ASSOC).
Both numeric and associative indexes – use $connection->SetFetchMode(ADODB_FETCH_BOTH).
The default is ADODB_FETCH_BOTH for Oracle.
Respectively
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
and
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
From the manual:
If no fetch mode is predefined, the fetch mode defaults to ADODB_FETCH_DEFAULT. The behaviour of this default mode varies from driver to driver, so do not rely on ADODB_FETCH_DEFAULT. For portability, we recommend sticking to ADODB_FETCH_NUM or ADODB_FETCH_ASSOC. Many drivers do not support ADODB_FETCH_BOTH.
精彩评论