Home > php教程 > php手册 > 在Windows版的PHP中使用ADO

在Windows版的PHP中使用ADO

WBOY
Release: 2016-06-13 12:40:15
Original
870 people have browsed it

这个例子建了一个连接,用ODBC打开Access的数据库NorthWind(安装Access时带的示范)。在执行了SQL语句后,返回了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;  
$fld0 = $rs->Fields(0);  
$fld1 = $rs->Fields(1);  
$fld2 = $rs->Fields(2);  
print "$fld0->value $fld1->value $fld2->value
";  
$rs->MoveNext();  
}  
$rs->Close();  
?> 

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template