Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在WHERE INDoctrine DBAL 中使用子句?
WHERE IN
以下查询不起作用,它搜索名称"Bob","Elvis","Bill"(作为字符串):
"Bob","Elvis","Bill"
$users = $dbc->fetchAssoc("SELECT * FROM users WHERE name IN(:users_names)", array( 'users_names' => '"Bob","Elvis","Bill"' ));
我尝试了一个数组,这是同样的问题。
尝试这个 :
$searchParameters = array("Bob","Elvis","Bill"); $users = "SELECT * FROM users WHERE name IN (?1)"; $q = $em->createQuery($users) ->setParameter(1, $searchParameters); $result = $q->execute();