ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:userguide:learn_fields:start_lesson

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
v5:userguide:learn_fields:start_lesson [2016/03/17 01:40] – created mnewnhamv5:userguide:learn_fields:start_lesson [2016/03/18 00:32] (current) mnewnham
Line 1: Line 1:
-<- v5:userguide:learn_fields:introduction|Introduction ^ v5:userguide:learn_fields:start_lesson|Start Of Lesson ^ v5:userguide:learn_fields:| ->+<- v5:userguide:learn_fields:introduction|Introduction ^ v5:userguide:learn_fields:start_lesson|Start Of Lesson ^ v5:userguide:learn_fields:associative_key_case|Associative Key Case ->
 ~~NOTOC~~ ~~NOTOC~~
 ====== Fields And Fields Objects ====== ====== Fields And Fields Objects ======
 +===== Formatting Of Returned Data =====
 +ADOdb provides a number of methods for controlling returned data. The data may be represented as arrays, both numeric and associative, and as objects.
 +
 +===== $ADODB_FETCH_MODE =====
 +The global variable [[v5:reference:adodb_fetch_mode|$ADODB_FETCH_MODE]] controls how the keys of the arrays containing the returned data are presented. The variable should be set **//before//** the query is executed. In addition to the variable, the constants **ADODB_FETCH_NUM,ADODB_FETCH_ASSOC,ADODB_FETCH_BOTH and ADODB_FETCH_NATIVE** are available to help. The available values are described as follows:
 +^Name^Value^Description^
 +|ADODB_FETCH_DEFAULT|0|The recordset is returned in the default provided by the PHP driver. Use of this value is not recommended if writing cross-database applications|  
 +|ADODB_FETCH_NUM|1|The recordset is returned as a numeric array|
 +|ADODB_FETCH_ASSOC|2|The recordset is returned as an associative array|
 +|ADODB_FETCH_BOTH|3|The record is returned as both a numeric and associative arrays. Not supported in some databases|
 +
 +  $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
 +returns:
 +  array([0] =>'v0',
 +        [1] =>'v1',
 +        [2] =>'v2',
 +        etc....
 +  )
 +
 +  $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;  
 +returns:
 +  array(['col0'] =>'v0',
 +        ['col1'] =>'v1',
 +        ['col2'] => 'v2',
 +        etc.....
 + )
 +
 +  $ADODB_FETCH_MODE = ADODB_FETCH_BOTH;  
 +returns:
 +  array([0] = 'v0',
 +        ['col0'] =>'v0',
 +        [1] = 'v1',
 +        ['col1'] =>'v1',
 +        [2] => 'v2',
 +        ['col2'] => 'v2',
 +        etc.....
 + )
 + 
 +
v5/userguide/learn_fields/start_lesson.1458175202.txt.gz · Last modified: 2017/04/21 11:40 (external edit)