A note on type-juggling of booleans:
pg_query_params() and friends do seamless, automatic conversion between PHP-NULL and SQL-NULL and back again, where appropriate.
Hoever, everything else goes in (and comes out) as a string.
The following approach may be helpful when handling boolean fields:
<?php
$sql = " ... ";
$params = array (1, 2, 3, true, false);
foreach ($params as &$value){
if (is_bool($value)){
$value = ($value) ? 'true':'false';
}
}
$result = pg_query_params ($sql, $params);
$row = pg_fetch_assoc ($result,0) foreach ($row as $key => &$value){
$type = pg_field_type($result,pg_field_num($result, $key));
if ($type == 'bool'){
$value = ($value == 't');
}
}
?>