php查询条件为一维数组

WBOY
Release: 2016-06-23 13:47:19
Original
1308 people have browsed it

PHP查询条件where id = array(1,2,3)怎么做


回复讨论(解决方案)

where id in (1,2,3)

$id = implode(',', array(1,2,3));
$sql = "....where id in ($id) ";

使用in可以

$id = array(1,2,3);$sqlstr = "select * from table where id in(".implode(',',$id).")";
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template