ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:adodb_assoc_case

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:reference:adodb_assoc_case [2019/05/08 16:51] – [ADODB_ASSOC_CASE] dregadv5:reference:adodb_assoc_case [2022/06/08 16:14] (current) – [Usage] fix code samples to reflect correct initialization of ADODB_ASSOC_CASE dregad
Line 4: Line 4:
 When returning data in **associative //[[v5:reference:connection:setfetchmode|fetch mode]]//**, the ''ADODB_ASSOC_CASE'' constant gives control over the casing of the retrieved recordsets' fields.  When returning data in **associative //[[v5:reference:connection:setfetchmode|fetch mode]]//**, the ''ADODB_ASSOC_CASE'' constant gives control over the casing of the retrieved recordsets' fields. 
  
-It must be declared **before** inclusion of the ADOdb libraries (''adodb.inc.php''), and being a constant it is of course not possible to change its value later on. +It must be declared **before** initializing the database connection with [[v5:reference:connection:adonewconnection|ADONewConnection()]]. 
 +Being a constantit is of course not possible to change its value later on.
  
 Note that this setting has no effect on the casing of the actual data. Note that this setting has no effect on the casing of the actual data.
Line 29: Line 30:
 ===== Usage ===== ===== Usage =====
 <code php> <code php>
-define('ADODB_ASSOC_CASE', ADODB_ASSOC_CASE_LOWER); 
 require "adodb.inc.php"; require "adodb.inc.php";
 +define('ADODB_ASSOC_CASE', ADODB_ASSOC_CASE_LOWER);
 $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
  
-// $db Connection assumed+$db = ADONewConnection('mysql'); 
 +$db->connect($host, $user, $password, $database);
  
 print_r($db->getAll("SELECT accountNo, accountName FROM table")); print_r($db->getAll("SELECT accountNo, accountName FROM table"));
Line 49: Line 51:
  
 or: or:
 +
 <code php> <code php>
-define('ADODB_ASSOC_CASE', ADODB_ASSOC_CASE_UPPER); 
 require "adodb.inc.php"; require "adodb.inc.php";
 +define('ADODB_ASSOC_CASE', ADODB_ASSOC_CASE_UPPER);
 $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
  
-// $db Connection assumed+$db = ADONewConnection('mysql'); 
 +$db->connect($host, $user, $password, $database);
  
 print_r($db->getAll("SELECT accountNo, accountName FROM table")); print_r($db->getAll("SELECT accountNo, accountName FROM table"));
Line 72: Line 76:
  
 <code php> <code php>
-define('ADODB_ASSOC_CASE', ADODB_ASSOC_CASE_NATIVE); 
 require "adodb.inc.php"; require "adodb.inc.php";
 +define('ADODB_ASSOC_CASE', ADODB_ASSOC_CASE_NATIVE);
 $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
  
-// $db Connection assumed+$db = ADONewConnection('mysql'); 
 +$db->connect($host, $user, $password, $database);
  
 print_r($db->getAll("SELECT accountNo, accountName FROM table")); print_r($db->getAll("SELECT accountNo, accountName FROM table"));
v5/reference/adodb_assoc_case.txt · Last modified: 2022/06/08 16:14 by dregad