3
說明:陣列至字符串轉換在學說查詢注意:Array對字符串Converstion在Doctrain查詢
foreach($listLocations as $k=>$location){
$list[] = "'".$location['id']."'";
}
$storesList = implode(',', $list);
//打印字符串(23)「 '191', '195',」 215' , '265'」
$storesList = (string)$storesList;
我改成了字符串,但在查詢它仍在考慮爲陣
$sql="SELECT * from tbl_students WHERE s.store_id IN (".$storesList .")";
$conn = $this->getEntityManager()->getConnection();
$stmt = $conn->prepare($sql);
好和快回答。很好的例子。 – Deep
@Deep thanks.Appreciate –
感謝您的回答,但仍然遇到同樣的問題。 – Developer