Re: variable with NULL value

From: Date: Thu, 03 May 2007 19:47:00 +0000
Subject: Re: variable with NULL value
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-43544@lists.php.net to get a copy of this message
OKi98 wrote:
Hi, one more question. Why the variable, that contains NULL value appears to be not set. When you try to echo it the php does not produce warning about using undefined variable. //$connection contains database connection handler $result=mysql_query("select NULL as value",$connection); $tmp=mysql_fetch_array($result); $foo=$tmp["value"]; if (!isset($foo)) echo("\$foo is not set but does not produce warning -$foo-"); OKi98 Someone correct me if I'm wrong but it appears that you should be using
if(!isset($tmp["value"]) before assigning to $foo if you want to ensure that $foo will, indeed, be set. -- Thanks, Jim

« previous php.db (#43544) next »