pg_fetch_result returns something other than boolean???

From: Date: Mon, 02 Sep 2002 03:53:40 +0000
Subject: pg_fetch_result returns something other than boolean???
Groups: php.db 
Request: Send a blank email to php-db+get-21511@lists.php.net to get a copy of this message
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

« previous php.db (#21511) next »