PHP Postgresql使用IN和pg_query_params

时间:2015-09-15 16:53:09

标签: php postgresql

我可以将值传递给此查询吗?如果是这样,$ arr的格式是什么?

$sql = "SELECT * FROM tree WHERE tree_id IN $1";
$result2  = pg_query_params($sql2,[$arr]);

1 个答案:

答案 0 :(得分:0)

$sql = "SELECT * FROM tree WHERE tree_id = ANY ($1)";
$result2  = pg_query_params($sql2,[$arr]);

$ arr format example =“{12,13}”