سؤال

I would like to use pg_prepare with the IN operator

SELECT id FROM people WHERE name IN $1;

I'd also like to use it with postgres arrays, I can't seem to get either to work and am unable to find it in the documentation.

Thanks for your help,

Mark

هل كانت مفيدة؟

المحلول

Here they speak about what you are looking for : http://www.php.net/manual/en/function.pg-prepare.php#62675

$result = pg_prepare($dbconn, "my_query", 'SELECT id FROM people WHERE name IN($1,$2,$3)'); 
$result = pg_execute($dbconn, "my_query", array("foo", "bar", "test"));
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top