Home  >  Article  >  Backend Development  >  php?数据库查询

php?数据库查询

WBOY
WBOYOriginal
2016-06-20 12:52:47881browse

 $id=array(23,24); $sql =" select `series_title` FROM ca_series where id in $id";//我想查id在23,24里的内容echo $sql;输出的效果:select `series_title` FROM ca_series where id in Array想要的效果:select `series_title` FROM ca_series where id in (23,24);


回复讨论(解决方案)

你只是查的整个数组吧,并没有具体数组里的某个值。

$id = array(23,24);
$in = join(',', $id);
$sql = "select `series_title` FROM ca_series where id in ( $in)";

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php5.3 XHProf性能测试Next article:PHP之PDO-prepare