PHP access data connection and reading, saving and editing data_PHP tutorial

WBOY
Release: 2016-07-20 11:07:48
Original
713 people have browsed it

php tutorial access data connection and reading and saving data analysis

$conn = new com("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb )}; DBQ=". realpath("www.bkjia.com/db.mdb");
//The com interface is used to connect with access.
$conn->Open($connstr);
$rs = new com("ADODB.RecordSet");
//Data query and display
$rs->Open( "select * from szd_t",$conn,1,1);
while(! $rs->eof) {
$f = $rs->Fields(1);
echo $ f->value;
$rs->MoveNext();
}

//Let’s take a look at the php access database tutorial to save

$sql ="insert into szd_t(title)values('www.bkjia.com')";

$rs->Open( $sql );
echo 'save successfully';

/ /php access database editing

$sql ="Update szd_t set title="php100.com" where id=".$_GET['id'];

$rs->Open ( $sql );
echo 'edit successfully';

//Delete data

$sql ="delete from szd_t where id=".$_GET['id'];

//This article was originally published on www.bkjia.com, please indicate the source when reprinting


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444945.htmlTechArticlephp tutorial access data connection and reading and saving data parsing $conn = new com(ADODB.Connection); $connstr = DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=. realpath(www.bkjia.com/db.mdb...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!