【发布时间】:2019-12-24 18:33:38
【问题描述】:
我尝试了不同的方法,但仍然无法正常工作。下面的代码有效,但我需要添加另一个 where 子句。如何在我的 SQL 查询中添加更多 WHERE 子句?
public function getuserAcct(){
$user_id = $this->param['user_id'];
$meter = $this->param['meter'];
$phone = $this->param['phone'];
$stmt=$this->dbConn->prepare("SELECT * FROM Monify Where user_id=".$user_id);
$stmt->execute();
$response=$stmt->fetch(PDO::FETCH_ASSOC);
if($response || $response == 0)
{
$this->returnResponse(SUCCESS_RESPONSE,$response);
}
else
{
$this->returnResponse(ERROR,$response);
}
}
【问题讨论】:
-
好的..你能帮我添加第二个 where 类...第二个列等于 $secondvariable
-
您的代码似乎容易受到 SQL 注入攻击。
标签: php sql pdo where-clause