- excel表格工作表或工作薄忘记密码2024-04-15 07:44:27
- EXCEL工作表保护密码破解2023-12-12 10:49:46
- bqt脚本启动chrome并打开某页面2023-05-17 08:48:30
- C#窗体间传递数据2022-01-26 10:01:31
- C# 实现WebSocket通信实例2022-01-20 10:22:05
作者: 发表时间:2013/8/16 11:01:39浏览量:1003【小中大】
$conn = new com("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("../mydata.mdb");
$conn->Open($connstr);
$rs = new com("ADODB.RecordSet");
$rs->Open("select * from userinfo",$conn,1,1);
while(! $rs->eof) {
$f = $rs->Fields(1);
echo $f->value;
echo " ". $rs->Fields(2)->value;
$rs->MoveNext();
}
?>
2、PHP一般数据写入方法:
$connstr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("../chen416/mydata.mdb");
$connid=odbc_connect($connstr,"","",SQL_CUR_USE_ODBC);
$issuetime=date("Y-m-d H:i:s");
$sql="insert into userinfo (username,userword,email) values('u2','w2','uw@163.com')";
$result=odbc_exec($connid,$sql);
if($result) echo "successful";
else echo "failed";
?>
3、PHP一般数据读取方法:
$conn=new COM("ADODB.Connection");
$dsn="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=".realpath("../mydata.mdb").";";
//Uid=Admin; Pwd=BDC2002Data;
$conn->open($dsn);
$sql="select * from userinfo";
$rs=$conn->Execute($sql);
$row="0";
while(!$rs->EOF)
{
$string ="";
for ($i=0;$i<$rs->Fields->count;$i++)
{
$string.=$rs->Fields($i)->Value;
continue;
}
$string.="\n";
if ($row==300)
{
}
$row++;
";
}
?>
4、PHP删除数据方法:
$conn = new com("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("../mydata.mdb");
$conn->Open($connstr);
$query
$result
if($result)
echo
else
echo
?>
5、PHP更新数据方法:
$conn = new com("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("../mydata.mdb");
$conn->Open($connstr);
$query
$result
if($result)
echo
else
echo
?>