ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:userguide:deprecated

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
v5:userguide:deprecated [2016/03/14 00:52]
mnewnham
v5:userguide:deprecated [2018/06/27 16:16] (current)
dregad function names starting with lowercase (#430)
Line 5: Line 5:
  
 <code php> <code php>
- 
 include('adodb.inc.php'); # load code common to ADOdb include('adodb.inc.php'); # load code common to ADOdb
- +$conn = &adoNewConnection('mysql');  # create a connection 
-$conn = &ADONewConnection('mysql');  # create a connection +$conn->pConnect('localhost','userid','','agora');# connect to MySQL, agora db
- +
-$conn->PConnect('localhost','userid','','agora');# connect to MySQL, agora db +
 $sql = 'select CustomerName, CustomerID from customers'; $sql = 'select CustomerName, CustomerID from customers';
- +$rs = $conn->execute($sql); 
-$rs = $conn->Execute($sql); +print $rs->getMenu('GetCust','Mary Rosli');
- +
-print $rs->GetMenu('GetCust','Mary Rosli'); +
 </code> </code>
  
Line 31: Line 24:
 include_once('/path/to/adodb/adodb.inc.php'); include_once('/path/to/adodb/adodb.inc.php');
  
-$db = &NewADOConnection('mysqli');+$db = &newADOConnection('mysqli'); 
 +$db->connect($server, $userid, $password, $database);
  
-$db->Connect($server, $userid, $password, $database); +$rs = $db->execute('select fname as "First Name", surname as "Surname" from table');
- +
-$rs = $db->Execute('select fname as "First Name", surname as "Surname" from table');+
  
 print "<pre>"; print "<pre>";
- 
 print rs2csv($rs); # return a string, CSV format print rs2csv($rs); # return a string, CSV format
 print '<hr>'; print '<hr>';
  
-$rs->MoveFirst(); # note, some databases do not support MoveFirst+$rs->moveFirst(); # note, some databases do not support MoveFirst
 print rs2tab($rs,false); # return a string, tab-delimited print rs2tab($rs,false); # return a string, tab-delimited
                          # false == suppress field names in first line                          # false == suppress field names in first line
 print '<hr>'; print '<hr>';
  
-$rs->MoveFirst();+$rs->moveFirst();
  
 rs2tabout($rs); # send to stdout directly (there is also an rs2csvout function) rs2tabout($rs); # send to stdout directly (there is also an rs2csvout function)
Line 53: Line 44:
 print "</pre>"; print "</pre>";
  
-$rs->MoveFirst(); +$rs->moveFirst();
 $fp = fopen($path, "w"); $fp = fopen($path, "w");
- 
 if ($fp) { if ($fp) {
- 
   rs2csvfile($rs, $fp); # write to file (there is also an rs2tabfile function)   rs2csvfile($rs, $fp); # write to file (there is also an rs2tabfile function)
- 
   fclose($fp);   fclose($fp);
- 
 } }
 </code> </code>
v5/userguide/deprecated.txt · Last modified: 2018/06/27 16:16 by dregad