时间:2020-11-25 12:34:02 | 栏目:PHP代码 | 点击:次
PHP PDO Access链接
}
/*读取*/
function Read($sql,$params=array())
{
$bind=$this->conn->prepare($sql);
$arrKeys=array_keys($params);
foreach($arrKeys as $row)
{
$bind->bindValue(":".$row,$params[$row]);
}
$bind->execute() or die('sql error:'.$sql);
$result=$bind->fetchAll();
return $result;
}
/*添加,修改需调用此方法*/
function Edit($sql,$params=array())
{
$bind=$this->conn->prepare($sql);
$arrKeys=array_keys($params);
foreach($arrKeys as $row)
{
$bind->bindValue(":".$row,$params[$row]);
}
$a=$bind->execute() or die('sql error');
return $a;
}
}
$dbh =new DbHelpClass();