note 24903 added to function.pg-fetch-result

From: Date: Wed, 04 Sep 2002 13:12:19 +0000
Subject: note 24903 added to function.pg-fetch-result
Groups: php.notes 
Request: Send a blank email to php-notes+get-36107@lists.php.net to get a copy of this message
Comment on boolean fields: If you retrieve a boolean value from the PostgreSQL database, be aware that the value returned will be either the character 't' or the character 'f', not an integer. So, the statement if (pg_fetch_result($rsRecords,0,'blnTrueFalseField')) { echo "TRUE"; } else { echo "FALSE"; } will echo "TRUE" in either case (True or False stored in the field). In order to work as expected, do this instead: if (pg_fetch_result($rsRecords,0,'blnTrueFalseField') == 't') { echo "TRUE"; } else { echo "FALSE"; } -- http://www.php.net/manual/en/function.pg-fetch-result.php http://master.php.net/manage/user-notes.php?action=edit+24903 http://master.php.net/manage/user-notes.php?action=delete+24903 http://master.php.net/manage/user-notes.php?action=reject+24903

« previous php.notes (#36107) next »