Error in uncompressing how to call asscess database and COM program through ADO in PHP

Source: Internet
Author: User
Author: John Lim.
Translation: Znsoft (http://www.phpease.com znsoftm@21cn.com)
PHP4 already supports Microsoft's COM technology. However, in the documentation, the COM section is rarely mentioned.
Here are a few examples that I have tried. Hope these give you some ideas. Note that these can only be run under the 32-bit Microsoft Windows platform.
Activating ADO with PHP
ADO is Microsoft's database object technology. ADO includes objects that connect to the database, Recordset objects that return data from query statements, and Field objects that represent data elements.
Many databases do not directly support ADO. This is because many databases support two levels of Microsoft Database technology: ODBC and OLE DB. Many databases support ODBC, but OLE DB has a faster reputation than ODBC.
ADO is an API that wraps ODBC and OLE DB.
This example opens a new ADO Connection object, opens a traditional Access database over ODBC, and then we execute the SQL query, which returns a Recordset object. We then show the first three fields of the recordset.
$DBC = new COM ("ADODB. Connection ");
$dbc->provider = "MSDASQL";
$dbc->open ("Nwind");
$rs = $dbc->execute ("SELECT * FROM Products");
$i = 0;
while (! $rs->eof) {
$i + = 1;
$FLD 0 = $rs->fields (0);
$FLD 1 = $rs->fields (1);
$FLD 2 = $rs->fields (2);
Print "$fld 0->value $fld 1->value $fld 2->value
";
$rs->movenext ();
}
$rs->close ();
?>
Call Microsoft Word in PHP
This is another example:
$word =new COM ("Word.Application") or Die ("Cannot start Microsoft word");
Print "Loaded Word version ($word->version) \ n";
$word->visible = 1;
$word->documents->add ();
$word->selection->typetext ("This is a Test");
?>

The above describes how error in uncompressing can invoke asscess database and COM programs in PHP, including the error in uncompressing, and hopefully help friends who are interested in PHP tutorials.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.