I am having trouble with the pg_fetch_result function when trying to access
a boolean field in a PostgreSQL database.  Here's the code snippet:

$strField = "blnAllDayEvent";
$intFieldNum = pg_field_num($rsEvent,$strField);
echo "Field type for " . $strField . " is " .
pg_field_type($rsEvent,$intFieldNum);
echo " and the value is " . pg_fetch_result($rsEvent,$i,$strField);
if (pg_fetch_result($rsEvent,$i,$strField)) {
  echo " or TRUE";
} else {
  echo " or FALSE";
}
echo "<br/>";
$strField = "blnRecurringEvent";
$intFieldNum = pg_field_num($rsEvent,$strField);
echo "Field type for " . $strField . " is " .
pg_field_type($rsEvent,$intFieldNum);
echo " and the value is " . pg_fetch_result($rsEvent,$i,$strField);
if (pg_fetch_result($rsEvent,$i,$strField)) {
  echo " or TRUE";
} else {
  echo " or FALSE";
}

The displayed information is:

Field type for blnAllDayEvent is bool and the value is f or TRUE
Field type for blnRecurringEvent is bool and the value is t or TRUE

Obviously, 'f' is NOT true.  So, is this a bug or am I doing something
wrong?

I'm using PostgreSQL v7.2.1, PHP v4.2.1, on a FreeBSD 4.5-STABLE system.

-matt



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to