PHP PDO search for a value in two or more columns using one string

前端 未结 4 1143
清酒与你
清酒与你 2020-12-10 23:54

When I want to find a value from a row using PDO I use the following method:

//Search whether user exists
$sqlQueryEmailLogin = $dbh->prepare(\"SELECT ven         


        
4条回答
  •  不知归路
    2020-12-11 00:13

    You should use OR instead of AND. That way, you will get all rows that match either by id or by status.

    SELECT * FROM articles WHERE id = ? OR status = ?
    

提交回复
热议问题