You are here: Re: Anoying problem with multiple 'elseif' variations... « PHP Language « IT news, forums, messages
Re: Anoying problem with multiple 'elseif' variations...

Posted by AF on 10/10/16 11:21

On Sat, 16 Jul 2005 00:25:25 +0200, "Peter Butler"
<peterbutler@iafrica.com> wrote:

>OK, lets see...
>
>I have 10 text boxes to enter keywords into a form page (The master search
>page)
>
>These boxes are either set or not set when passed to the result page as set
>or unset variables.
>
>Depending on which variables have been set, the set variables are used to
>formulate the query.
>
>I have got this to work perfectly... but I am convinced that I'm using the
>dinosour method. ie.:
>
>if ($a==a && $b==a && $c==a && $d==a && $e==a && $f==a && $g==a && $h==a &&
>$i==a && $j==a)
> { do thing AA}
>elseif ($a!=a && $b==a && $c==a && $d==a && $e==a && $f==a && $g==a && $h==a
>&& $i==a && $j==a)
> { do thing BB}
>elseif ($a==a && $b!=a && $c==a && $d==a && $e==a && $f==a && $g==a && $h==a
>&& $i==a && $j==a)
> { do thing CC}
>elseif ($a==a && $b==a && $c!=a && $d==a && $e==a && $f==a && $g==a && $h==a
>&& $i==a && $j==a)
> { do thing DD}
>elseif ($a==a && $b==a && $c==a && $d!=a && $e==a && $f==a && $g==a && $h==a
>&& $i==a && $j==a)
> { do thing EE}
>elseif ($a==a && $b==a && $c==a && $d==a && $e!=a && $f==a && $g==a && $h==a
>&& $i==a && $j==a)
> { do thing FF}
>elseif ($a==a && $b==a && $c==a && $d==a && $e==a && $f!=a && $g==a && $h==a
>&& $i==a && $j==a)
> { do thing GG}
>elseif ($a==a && $b==a && $c==a && $d==a && $e==a && $f==a && $g!=a && $h==a
>&& $i==a && $j==a)
> { do thing HH}
>elseif ($a==a && $b==a && $c==a && $d==a && $e==a && $f==a && $g==a && $h!=a
>&& $i==a && $j==a)
> { do thing II}
>elseif ($a==a && $b==a && $c==a && $d==a && $e==a && $f==a && $g==a && $h==a
>&& $i!=a && $j==a)
> { do thing JJ}
>elseif ($a==a && $b==a && $c==a && $d==a && $e==a && $f==a && $g==a && $h==a
>&& $i==a && $j!=a)
> { do thing KK}
>
>/* then different combos of two's */
>elseif ($a!=a && $b!=a && $c==a && $d==a && $e==a && $f==a && $g==a && $h==a
>&& $i==a && $j==a)
> { do thing BB}
>elseif ($a!=a && $b==a && $c!=a && $d==a && $e==a && $f==a && $g==a && $h==a
>&& $i==a && $j==a)
> { do thing BB}
>elseif ($a!=a && $b==a && $c==a && $d!=a && $e==a && $f==a && $g==a && $h==a
>&& $i==a && $j==a)
> { do thing BB}
>elseif ($a!=a && $b==a && $c==a && $d==a && $e!=a && $f==a && $g==a && $h==a
>&& $i==a && $j==a)
> { do thing BB}
>elseif ($a!=a && $b==a && $c==a && $d==a && $e==a && $f!=a && $g==a && $h==a
>&& $i==a && $j==a)
> { do thing BB}
>etc, etc, etc...........
>
>/* then different combos of threes */
>elseif ($a!=a && $b!=a && $c!=a...
> {do thing wada-wada...
>elseif ($a!=a && $b!=a && $c==a...
> {do thing wada-wada...
>elseif ($a!=a && $b!=a && $c==a...
> {do thing wada-wada...
>etc, etc, etc...........
>
>/* then different combos of fours */
>elseif ($.......................................................
>elseif ($.......................................................
>elseif ($.......................................................
>etc, etc, etc...........
>
>/* then different combos of fives */
>elseif ($.......................................................
>elseif ($.......................................................
>elseif ($.......................................................
>etc, etc, etc...........
>
>/* then different combos of sixes */
>elseif ($.......................................................
>elseif ($.......................................................
>elseif ($.......................................................
>etc, etc, etc...........
>
>/* then different combos of sevens */
>elseif ($.......................................................
>elseif ($.......................................................
>elseif ($.......................................................
>etc, etc, etc...........
>
>/* then different combos of eights */
>/* then different combos of nines */
>
>/* until... three thousand six hundred and forty-nine lines of code later
>we get to make*/
>elseif ($a!=a && $b!=a && $c!=a && $d!=a && $e!=a && $f!=a && $g!=a && $h!=a
>&& $i!=a && $j!=a)
> { do thing XXXXXXX}
>
>- OK... For those eagle eyes out there... I actually have 14 different
>fields in which to set variables... two pairs of which are grouped together
>as max/min values,
>but I do really have 3649 lines of stuff that is slowing down my DUAL PIII
>500 on saves.
>
>This can't be the right way... really???
>
>
Can you give us an example? I may have a better way to do this. See
a post I made in several threads earlier in response to your previous
posting.

But my method may not be appropriate depending on what you are trying
to do.

Do you have a web page we could look at?

Please post the url to this sample page.


Best regards,

Al
http://www.affordablefloridainsurance.com
http://www.americanbestmortgages.com
http://www.americanaffordablelifeinsurance.com

 

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

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