note 89194 added to language.types.boolean

From: Date: Thu, 26 Feb 2009 03:59:53 +0000
Subject: note 89194 added to language.types.boolean
Groups: php.notes 
Request: Send a blank email to php-notes+get-151142@lists.php.net to get a copy of this message
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 ---- Server IP: 208.69.120.35 Probable Submitter: 141.218.23.101 ---- Manual Page -- http://www.php.net/manual/en/language.types.boolean.php Edit -- https://master.php.net/note/edit/89194 Del: integrated -- https://master.php.net/note/delete/89194/integrated Del: useless -- https://master.php.net/note/delete/89194/useless Del: bad code -- https://master.php.net/note/delete/89194/bad+code Del: spam -- https://master.php.net/note/delete/89194/spam Del: non-english -- https://master.php.net/note/delete/89194/non-english Del: in docs -- https://master.php.net/note/delete/89194/in+docs Del: other reasons-- https://master.php.net/note/delete/89194 Reject -- https://master.php.net/note/reject/89194 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#151142) next »