我对这个问题很着迷,我想从数据库中获取一个用逗号(字符串)分隔的数组,例如:(1,2,4,6),并将其作为变量插入到查询中,例如(从表中选择where id IN($variable string). 谁能帮我解决这个问题?
例子:
<?php
//connect
$sql = "select id from users where id=1";
//get the results as an array
在此查询中插入该变量
select from table where id IN($variable);
//
?>
我尝试了多种方法,但总是遇到不同的问题。请需要一个答案!