Php 数组到字符串转换SQL Symfony
我有一个sql请求:Php 数组到字符串转换SQL Symfony,php,sql,symfony,Php,Sql,Symfony,我有一个sql请求: $listUsers=$connection->prepare("SELECT u.id as userid From user u , account a where a.id_parent=$id_account OR a.id=$id_account and u.id_account=a.id "); $listUsers->execute(); $users=$listUsers->fetchAll(); 这个请求为我返回一个u
$listUsers=$connection->prepare("SELECT u.id as userid From user u , account a where a.id_parent=$id_account OR a.id=$id_account and u.id_account=a.id ");
$listUsers->execute();
$users=$listUsers->fetchAll();
这个请求为我返回一个userid列表
我还有一个要求:
$listPush=$connection->prepare("select id from table_names where id_user in (?)");
$listPush->bindValue(1, $users);
$listPush->execute();
但这不起作用,我用内爆来提取用户的id,但也不起作用
at ErrorHandler ->handleError ('8', 'Array to string conversion', 'C:\wamp\www\CleverMultimedias\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php', '67', array('param' => '1', 'value' => array(array('userid' => '10')), 'type' => '2'))
at PDOStatement ->bindValue ('1', array(array('userid' => '10')), '2')
你有什么想法吗?我认为你的$users应该等于像“1,2,3,4”这样的字符串,而不是数组