我必须创建一条SQL命令,用于在数据库表中查找与我的数组中包含的某个字符串匹配的字符串。如何查找匹配数组中的字符串的字符串
//this is my array
$liste_des_themes=array("Préfectures et sous-préfectures","Mairie","Banque");
$stmt = $this->db->prepare('SELECT * FROM etablissements where type IN $liste_des_themes');//i tried this but seems not working
$stmt->execute();
$stmt->bind_result($id, $libelle);
while ($stmt->fetch()) {
echo "$id $libelle<br/>";
}
$stmt->close();
试试...'$这个 - > DB->准备( “SELECT * FROM ETABLISSEMENTS凡类型('” .implode(“','”,$ liste_des_themes)。“');' – Rufinus 2012-01-03 15:50:46
@Rufinus作为答案添加答案,澄清问题和见解作为评论 – 2012-01-03 15:51:59