Re: skip a row in foreach loop

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

 



afan@xxxxxxxx wrote:
I have a code

foreach($results as $key => $value)
{
   echo $key.': '. $value .'<br>';
}

But, $value could be zero too.
How to skip printing on screen when $vlaue == 0?

I know I can do
foreach($results as $key => $value)
{
   if(!empty($value))
   {
       echo $key.': '. $value .'<br>';
   }
}

Is $results coming from a db? Select only the rows which do not have a value of 0.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@xxxxxxxxxxxx

--
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