[FX.php List] Problem with site on client's server
Joel Shapiro
jsfmp at earthlink.net
Thu Oct 18 12:42:20 MDT 2007
Thanks Steve
Yeah, I also used to use if($skipSize == '') until people on this
list talked about "low-level" PHP errors. I'm guessing Notices are
some of these.
And that's a good reminder that isset() could be true even if the
value is empty, such as when a variable gets set and then it's value
later cleared/emptied ($var='') instead of unset (unset($var))
Best,
-Joel
On Oct 18, 2007, at 11:16 AM, Steve Winter wrote:
> Hi Joel,
>
> With all errors set to show, including Notices then
> if($skipSize)
> and
> if($skipSize == '')
> will both return notices about undefined index... I know that at
> times I
> used to get a bit lazy and just use the first of these...
>
> Your first one however
> if(isset($skipSize))
> is fine, and I tend to extend that further to be
> if(isset($skipSize) && $skipSize != '')
> as that way you check both that the variable actually exists, and
> that it
> has no value...
>
> Hope this clarifies things... ;-)
>
> Cheers
> Steve
>
>
> -----Original Message-----
> From: fx.php_list-bounces at mail.iviking.org
> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Joel
> Shapiro
> Sent: Thursday, 18 October 2007 6:59 p.m.
> To: FX.php Discussion List
> Subject: Re: [FX.php List] Problem with site on client's server
>
> oops.
>
> actually should have been
>
> e.g. if ( !isset( $skipSize )) vs. if ( $skipSize == '' )
>
> to make them comparable
>
> ! + isset
>
> -Joel
>
>
> On Oct 18, 2007, at 10:51 AM, Joel Shapiro wrote:
>
>> Hmm... Were you using isset()? (I wouldn't have thought that that
>> could cause an error)
>>
>> e.g. if ( isset( $skipSize )) vs. if ( $skipSize == '' )
>>
>> -Joel
>>
>>
>> On Oct 18, 2007, at 10:27 AM, Bob Patin wrote:
>>
>>> Joel,
>>>
>>> Actually it wasn't a counter variable; it was my skip variable for
>>> doing previous/next code for page views. I had an IF statement
>>> that said, if $skipSize isn't set, set it to zero; so rather than
>>> that goofy method I just put a hidden variable on the form, to set
>>> the skipSize to zero. That way the variable is set no matter how
>>> it's used.
>>>
>>> So it either gets set to zero when the query is performed, or it
>>> gets reset to an appropriate value when the PREV/NEXT buttons are
>>> used on the results page.
>>>
>>> Bob
>>>
>>>
>>> On Oct 18, 2007, at 12:15 PM, Joel Shapiro wrote:
>>>
>>>> Hey Bob
>>>>
>>>> Can you give an example of your undeclared variable?
>>>>
>>>> Do you mean you used a counter variable in a loop without
>>>> starting it equal to zero?
>>>>
>>>> -Joel
>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.14.12/1072 - Release Date:
> 15/10/2007
> 5:55 p.m.
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.14.12/1072 - Release Date:
> 15/10/2007
> 5:55 p.m.
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
More information about the FX.php_List
mailing list