-1

I have an sql request:

$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();

this request return for me a list of userid.

I have the other request:

             $listPush=$connection->prepare("select id from table_names where id_user in (?)");
        $listPush->bindValue(1, $users);
        $listPush->execute();

but this does not work, I used implode to extract the id of users but also does not work.

    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') 

any idea please

Majdi Taleb
  • 731
  • 3
  • 9
  • 26

1 Answers1

-1

I think your $users should be equaled to some string like "1,2,3,4" instead of array

Chin Lee
  • 133
  • 1
  • 1
  • 8