dongwo2222
2016-02-09 19:03
浏览 214
已采纳

PHP字符串在MYSQL IN()中不起作用

I just add code because it will say everything. And yes, it does not work and I dont know why :(

$array = array('One', 'Two', 'Three');
$string = "'" . implode("', '", $array) . "'";

$query = "SELECT * FROM $table WHERE name IN (" . $string . ")";
$make = $this->conn->prepare($query);
$make->execute();
$result = $make->fetchAll();

It returns empty array. Thank you for your help.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题