×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Ian Willow
Added: Jun 18, 2016 7:07 PM
Views: 11
Ado connection to Ms Access database.
  1. <?
  2. $conn = new COM("ADODB.Connection") or die("Cannot start ADO");
  3.  
  4. // Microsoft Access connection string.
  5. $conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\\inetpub\\wwwroot\\php\\mydb.mdb");
  6.  
  7. // SQL statement to build recordset.
  8. $rs = $conn->Execute("SELECT myfield FROM mytable");
  9. echo "<p>Below is a list of values in the MYDB.MDB database, MYTABLE table, MYFIELD field.</p>";
  10.  
  11. // Display all the values in the records set
  12. while (!$rs->EOF) {
  13.     $fv = $rs->Fields("myfield");
  14.     echo "Value: ".$fv->value."<br>\n";
  15.     $rs->MoveNext();
  16. }
  17. $rs->Close();
  18. ?>