Home > Backend Development > PHP Tutorial > 在Windows版的PHP中使用ADO_php基础

在Windows版的PHP中使用ADO_php基础

WBOY
Release: 2016-05-17 09:46:57
Original
845 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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template