Home > Backend Development > PHP Tutorial > 透过html传递过来的参数,php查询 access

透过html传递过来的参数,php查询 access

WBOY
Release: 2016-06-13 12:44:03
Original
925 people have browsed it

通过html传递过来的参数,php查询 access
html页面传递数据给php页面,作为条件参数查询,
数据库表 szd_t ;字段   username, password
我需要查询结果显示在html页面上,如何实现? 
$rs->Open("select * from szd_t where username="$_POST["name"],$conn,1,1); 这一句是否有问题? 其他代码至少语法没有错误,
完整代码如下:
//文件access.html


html




Name: 


 

//文件accessdb2.php
$conn = new com("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("db.mdb");
$conn->Open($connstr);
$rs = new com("ADODB.RecordSet");
$rs->Open("select * from szd_t where username="$_POST["name"],$conn,1,1);
while(! $rs->eof)
{
$f = $rs->Fields(1);
$f2 = $rs->Fields(0);
echo $f2->value;
echo $f->value;
$rs->MoveNext();
}
//echo "<script>alert('success!');</script>";
?>
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