Home  >  Article  >  Backend Development  >  Tutorial on using ADO_PHP with Windows version of PHP

Tutorial on using ADO_PHP with Windows version of PHP

WBOY
WBOYOriginal
2016-07-21 16:04:49827browse

This example creates a connection and uses ODBC to open the Access database NorthWind (demonstration included when installing Access). After executing the SQL statement, the RecordSet object is returned. The example shows the first three fields:

$dbc = new COM("ADODB.Connection");
$dbc->Provider = "MSDASQL";
$dbc->Open("nwind");
$rs = $dbc->Execute("select * from products");
$i = 0;
while (!$rs- >EOF) {
$i += 1;
$fld0 = $rs->Fields(0);
$fld1 = $rs->Fields(1);
$ fld2 = $rs->Fields(2);
print "$fld0->value $fld1->value $fld2->value
";
$rs->MoveNext( );
}
$rs->Close();
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/315869.htmlTechArticleThis example creates a connection and uses ODBC to open the Access database NorthWind (demonstration included when installing Access). After executing the SQL statement, the RecordSet object is returned. Example showing the top three...
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