Home >Backend Development >PHP Tutorial >UsingCOMwithPHP (I won't translate it)_PHP tutorial

UsingCOMwithPHP (I won't translate it)_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:12:50867browse

Using COM with PHP
     By John Lim.
PHP4 on Windows has been extended to support Microsoft's COM technology. However documentation on the COM functions is very sparse at the moment.
Here are some examples of stuff I have tried. Hope this gives you some ideas. Note that these only work when you are running PHP on a Windows Web server.
Active Data Objects (ADO) with PHP
ADO is Microsoft's database object technology. There are objects for connecting to databases, recordsets for data returned from queries, and field objects representing data elements.
Most databases do not support ADO directly. Instead most databases support 2 lower level Microsoft database technologies: ODBC and OLEDB. More databases support ODBC; but OLEDB has a reputation of being faster than ODBC.
ADO is then an API wrapper around ODBC and OLEDB.
This example opens a new ADO Connection object, opens the traditional NorthWind MS-Access database via ODBC. When we execute the SQL, a RecordSet object is returned. We then display the first 3 fields of the record-set.
    $dbc = new COM("ADODB.Connection");
    $dbc->Provider = "MSDASQL";
    $dbc->Open("nwind");
    $rs = $dbc->Execute("select * from products");
    $i = 0;
    $fld0 = $rs->Fields(0);
    $fld1 = $rs->Fields(1);
    $fld2 = $rs->Fields(2);
    while (!$rs->EOF) {
        $i += 1;
        print "$fld0->value $fld1->value $fld2->value
";
        $rs->MoveNext(); /*updates fld0, fld1, fld2 !*/
    }

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/629286.htmlTechArticleUsing COM with PHP By John Lim. PHP4 on Windows has been extended to support Microsoft's COM technology. However documentation on the COM functions is very sparse at the moment. Her...
Statement:
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