Re: Argh! nulls un stuff..

From: Date: Tue, 15 Oct 2002 09:14:58 +0000
Subject: Re: Argh! nulls un stuff..
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-119996@lists.php.net to get a copy of this message
i think that was one of the problems, some places the session var was set back as a string ("0") and other as int (0). anyway thanks to all, panic over all working now :) "Jason Young" <jason1@erols.com> wrote in message news:20021014174949.42306.qmail@pb1.pair.com... > My suggestion would be to checck for isset($_SESSION["temp"]) and if > ($_SESSION["temp"] > "0") with quotes .. PHP is very forgiving with data > types, and I've found its much easier to keep track of what exactly is > going on if I reference everything in a string format. > > -Jason > > Sam Masiello wrote: > > > How about something like this: > > > > if ($_SESSION["temp"] > 0) ? > > > > Or if you want to be really sure: > > > > if ($_SESSION["temp"] > 0 && $_SESSION["temp"] != > > "") > > > > OR....if you want to be sure the value is a number as well: > > > > if ($_SESSION["temp"] > 0 && $_SESSION["temp"] != > > "" && > > is_numeric($_SESSION["temp"]) > > > > HTH > > > > Sam Masiello > > Software Quality Assurance Engineer > > Synacor > > (716) 853-1362 x289 > > smasiello@synacor.com > > > > > > > > -----Original Message----- > > From: Francis [mailto:news@radnip.com] > > Sent: Monday, October 14, 2002 9:23 AM > > To: php-general@lists.php.net > > Subject: [PHP] Argh! nulls un stuff.. > > > > > > ok going mad all I need to do is check a variable and if it has a number > > in it then do something, so anything from 0 up, but it keeps thinking 0 > > is null and failing, anyway around this? or am I just being stupid as > > usual? > > > > $_SESSION["temp"] = 0; > > $tempVar = 0; > > > > if($_SESSION["temp"] !=""){ echo "!= condition > > "; } > > if(isset($_SESSION["temp"])){ echo "isset condition > > ";} > > if(isset($tempVar)){ echo "tempVar isset condition > > ";} if($tempVar > > !=""){ echo "tempVar != condition > > ";} if(!empty($tempVar)){ echo > > "tempVar !empty condition > > ";} > > > > > > > > > > >

« previous php.general (#119996) next »