note 89194 deleted from language.types.boolean by cmb
| From: | cmb@php.net | Date: | Wed, 22 Jun 2016 17:30:55 +0000 |
| Subject: | note 89194 deleted from language.types.boolean by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-205791@lists.php.net to get a copy of this message | ||
Note Submitter: ashafer01 at gmail dot com
----
A note when working with PostgreSQL - if you select a boolean field from the database, it returns
't' or 'f'. If you directly evaluate a variable storing a boolean from a
PostgreSQL database, it will always return true.
For example...
<?php
$x = pg_query("SELECT someBool FROM atable");
$x = pg_fetch_array($x);
$x = $x['someBool'];
if ($x) echo "true";
else echo "false";
?>
...ALWAYS outputs true