RE: [PHP] NULLS vs Empty result in PHP

From: Date: Wed, 23 Sep 2009 12:26:52 +0000
Subject: RE: [PHP] NULLS vs Empty result in PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-298271@lists.php.net to get a copy of this message
Use var_dump before processing your result. Regards, Samrat Kar FRD, BARC Tel: 022-25597295 Alternate Email: esamrat@yahoo.com -----Original Message----- From: Dan Shirah [mailto:mrsquash2@gmail.com] Sent: Wednesday, September 23, 2009 5:28 PM To: PHP General Subject: [PHP] NULLS vs Empty result in PHP Morning! Just a quick question. Say I have a column in my database that could contain NULLS, empty spaces, or an actual value. If I do: $my_query = "SELECT my_column FROM my_database WHERE 1 = 1"; $my_result = ifx_query($my_query, $connect_id); while($row = ifx_fetch_row($my_result)) { $my_column = trim($row['my_column']); if ($my_column != "") { echo "Test"; } } The way PHP assigns the query results to the $my_column variable, wouldn't; if ($my_column != "") not do anything for the rows that contained NULLS or empty spaces? No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 270.13.112/2388 - Release Date: 09/22/09 17:54:00

« previous php.general (#298271) next »