我想知道如何将quote()方法与query()一起使用? 我尝试时不起作用(示例ID): $ id = 1; “ ... FROM t_admin WHERE id =”。$ this-> quote($ id);
这是我的代码:
protected function executeRequest($sql, $params = null){
if ($params == null){
$result = $this->getDB()->query($sql);
}
elseif ($params != null){
$result = $this->getDB()->prepare($sql);
$result->execute($params);
}
return $result;
}
public function getMail()
{
$sql = "SELECT admin_mail FROM t_admin WHERE id=1";
$emailRequest = $this->executeRequest($sql);
foreach ($emailRequest as $data){
$this->email = $data['admin_mail'];
}
return $this->email;
}