RE: 2 ifs embedded?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 7/31/09 9:53 AM, "Bastien Koert" <phpster@xxxxxxxxx> wrote:
> 
> On Fri, Jul 31, 2009 at 10:28 AM, Miller,
> Terion<tmiller@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> >
> >
> > On 7/31/09 8:58 AM, "m0s" <dev@xxxxxxxx> wrote:
> >
> > (!empty($row['notes']) && IsAlpha($row['notes']))
> >
> > I tried that and this one:
> >
> > If (!empty($row['notes']) && ctype_alpha($row['notes']))
> >
> > It didn't display the notes at all...
> >
> > And this one...doesn't display if the field has a 0 in it but I still
> need it to?
> >
> > If (!empty($row['critical']) && ctype_alnum($row['critical']))
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> Hey Teri,
> Could the return from the db have a space or something in the value?
> Perhaps
> 
> If (!empty($row['critical']) && ctype_alnum((int)$row['critical']))
> 
> might work
> 
> 
> --
> 
> Bastien
> 
> Cat, the other other white meat
> 
> 
> It's got me stumped, tried it and it still will not echo if the field
> has a 0 in it:
> 
> If (!empty($row['critical']) && ctype_alnum((int)$row['critical'])){
> echo(" Critical violations found: ". $row['critical'] .". ");
> 

empty() regards 0 as an empty value... From the manual:

[quote]
The following things are considered to be empty:

    * "" (an empty string)
    * 0 (0 as an integer)
    * "0" (0 as a string)
    * NULL
    * FALSE
    * array() (an empty array)
    * var $var; (a variable declared, but without a value in a class)
[/quote]

HTH

Dan


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux