You are here: Re: modifying 'for... loop ' with php to leave out one number « PHP Programming Language « IT news, forums, messages
Re: modifying 'for... loop ' with php to leave out one number

Posted by Miguel Cruz on 12/17/22 11:54

"Ian Davies" <ian.dandav@virgin.net> wrote:
> Im using the following loop to populate a list box but I dont want th
> current selected value (from database) to show in the list
> The one I want to omitt is in the variable
>
> $row['bbannerorgfont']
>
> I wish to some how include this in the below loop to the effect of
>
> echo from 0 to 6 except for $row['bbannerorgfont']
>
> VB has select...case... etc. Is there something similar with PHP?

switch($i)
{
case 0:
do something;
break;
case 1:
do something else;
break;
}

> <?
> for($i = 0; $i < 7; $i++) {
> echo "<option value='".$i+1."'>".$i+1."</option><br>";
> }
> ?>

for ($i = 0; $i < 7; $i++)
{
if ($i == $row['bbannerorgfont'])
continue;
echo "<option value='" . $i + 1 . "'>" . $i + 1 . "</option><br>";
}


--
Photos from 40 countries on 5 continents: http://travel.u.nu
Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
Airports of the world: http://airport.u.nu

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация