मेरे एसक्यूएल इस तरह दिखता है:सिद्धांत - एसक्यूएल को सरणी कैसे बांधें?
$sql = "select * from user where id in (:userId) and status = :status";
$em = $this->getEntityManager();
$stmt = $em->getConnection()->prepare($sql);
$stmt->bindValue(':userId', $accounts, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY);
$stmt->bindValue(':status', 'declined');
$stmt->execute();
$result = $stmt->fetchAll();
लेकिन यह रिटर्न:
An exception occurred while executing (...)
with params [[1,2,3,4,5,6,7,8,11,12,13,14], "declined"]
Notice: Array to string conversion
मैं नहीं कर सकते हैं उपयोगकर्ता queryBuilder
क्योंकि मेरा असली एसक्यूएल अधिक जटिल है (पूर्व चयन में शामिल हो गए शामिल, यूनियनों और इतने पर।)
क्या आप foreach का उपयोग कर सकते हैं? 'foreach ($ $ = $ $ val के रूप में $ खातों) {$ stmt-> bindValue (': userId', $ val); } ' – pes502