Home >Backend Development >PHP Tutorial >access database programming PHP connection access database

access database programming PHP connection access database

WBOY
WBOYOriginal
2016-07-29 08:37:35988browse

Copy the code The code is as follows:


/*
Create ADO connection
*/
$conn = @new COM("ADODB.Connection") or die ("ADO Connection failed." );
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("DATUM/cnbt.mdb");
$conn->Open($connstr);
/*
Create record set query
*/
$rs = @new COM("ADODB.RecordSet");
$rs->Open("select * from dbo_dirs",$conn,1,3);
/*
Loop to read data
*/
while(!$rs->eof){
echo "$rs->Fields["title"]->Value;
echo "
";
$rs->Movenext(); //Move the record set pointer down
}
$rs->close();
?>

The above introduces the access database programming and PHP connection to the access database, including the content of access database programming. I hope it will be helpful to friends who are interested in PHP tutorials.

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