Home > Backend Development > PHP Tutorial > Example of php ADO component connecting to access database

Example of php ADO component connecting to access database

WBOY
Release: 2016-07-25 08:57:50
Original
1076 people have browsed it
  1. /*

  2. * Create ADO connection
  3. */
  4. $conn = new COM("ADODB.Connection") or die ("ADO Connection failed.");
  5. $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("test.mdb");
  6. $conn->open($connstr);
  7. /*
  8. * Create a record set
  9. */
  10. $rs = new COM("ADODB.RecordSet");
  11. $rs->open("select * from lhl",$conn,1,3);
  12. /*
  13. * Loop to read data
  14. */
  15. while(!$rs->eof){
  16. echo $rs->fields['G_date']->Value;
  17. echo "
    ";
  18. $rs->movenext (); //Move the record set pointer down
  19. }
  20. $rs->close();

  21. //ADO component example learning by bbs.it-home.org

  22. ?> ;

Copy code


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template