Voting

: one minus zero?
(Example: nine)

The Note You're Voting On

newby_AT_nobletec_DOT_com
22 years ago
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";
}

<< Back to user notes page

To Top