ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:userguide:learn_abstraction:key_value_pairs

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
v5:userguide:learn_abstraction:key_value_pairs [2016/08/14 21:44] mnewnhamv5:userguide:learn_abstraction:key_value_pairs [2021/02/21 13:45] (current) – typo, httpheader for json, param names for mysqli example peterdd
Line 44: Line 44:
 * Program adodbExample.php * Program adodbExample.php
 */ */
-include 'adodb_dir/adodb.inc.php';+include_once 'adodb_dir/adodb.inc.php';
  
 /* /*
Line 63: Line 63:
  
 $db = newAdoConnection('mysqli'); $db = newAdoConnection('mysqli');
-$db->connect('parameter1','parameter2','etc','etc');+#$db->debug=true; 
 +$db->connect('dbhost','dbuser','dbpassword','dbname');
  
 $sql = "SELECT state_code,name  $sql = "SELECT state_code,name 
          FROM us_states          FROM us_states
      ORDER BY state_code";      ORDER BY state_code";
-$result = $db->execute($SQL);+$result = $db->execute($sql);
 while ($r = $result->fetchRow()) while ($r = $result->fetchRow())
 { {
Line 80: Line 81:
 * Return the data to the calling progam * Return the data to the calling progam
 */ */
 +if(!$db->debug){
 +    header('Content-Type: application/json');
 +}
 print json_encode($rows); print json_encode($rows);
 </code> </code>
v5/userguide/learn_abstraction/key_value_pairs.1471203876.txt.gz · Last modified: 2017/04/21 11:40 (external edit)