2023-03-21

How to pass PHP array to Postgres query as a parameter

I try to pass a PHP array to Postgres as below but I'm getting an error;

$arrayIDs = array('24','7','8','9','13');

$data = SelectItemsForUpdate($arrayIDs);

function SelectItemsForUpdate($arrayIDs) 
{ 
  $query = PrepareQuery('select id, quantity from items where id in ($1) for update ');      
  $result = ExecutePreparedQuery($query, Array($arrayIDs));          
  ...
  ...
} 
   


No comments:

Post a Comment