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

access database programming PHP connection access database

WBOY
Release: 2016-07-29 08:37:35
Original
1007 people have browsed it

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.

Related labels:
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