Anoying problem with multi $var combinations Pse help..

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Butler

    #1

    Anoying problem with multi $var combinations Pse help..

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




















  • Shelly

    #2
    Re: Anoying problem with multi $var combinations Pse help..


    "Peter Butler" <peterbutler@ia frica.com> wrote in message
    news:Ku-dneUrvbgspEXfRV n-3A@is.co.za...[color=blue]
    > 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???[/color]

    Off the top of my head, I would use a bitwise logical to find the value.
    E.G.

    $target = 0;
    if ($a == a) $target = $target | 1;
    if ($b == a) $target = $target | 2;
    if ($c == a) $target = $target | 4;
    if ($d == a) $target = $target | 8;

    and so on.

    Then I would do a header("Locatio n: theFile_" . $target . ".php");

    and you can have as many small files to do as many little things as you
    want. Then, any given file is small and easily processed.

    Just off the top of my head. It might or might not work.

    Shelly


    Comment

    • Shelly

      #3
      Re: Anoying problem with multi $var combinations Pse help..


      "Shelly" <sheldonlg.news @asap-consult.com> wrote in message
      news:OsadnfvxuI Q5o0XfRVn-hA@comcast.com. ..[color=blue]
      >
      > "Peter Butler" <peterbutler@ia frica.com> wrote in message
      > news:Ku-dneUrvbgspEXfRV n-3A@is.co.za...[color=green]
      >> 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???[/color]
      >
      > Off the top of my head, I would use a bitwise logical to find the value.
      > E.G.
      >
      > $target = 0;
      > if ($a == a) $target = $target | 1;
      > if ($b == a) $target = $target | 2;
      > if ($c == a) $target = $target | 4;
      > if ($d == a) $target = $target | 8;
      >
      > and so on.
      >
      > Then I would do a header("Locatio n: theFile_" . $target . ".php");
      >
      > and you can have as many small files to do as many little things as you
      > want. Then, any given file is small and easily processed.
      >
      > Just off the top of my head. It might or might not work.
      >
      > Shelly[/color]

      Or rather than having a zillion small files (many of which probably do the
      same thing), you could simply have a switch statement and group numbers that
      do the same thing.

      switch ($target) {
      case 1: stuff
      break;
      case 2:
      }

      Shelly

      Shelly


      Comment

      • Shelly

        #4
        Re: Anoying problem with multi $var combinations Pse help..

        More off the top of my head: Here is an example:

        $query = "select ";
        if ($_POST('a') == a) $query . "$a set stuff with a comma at the end";
        .....repeat for all.....
        .....remove the last comma...
        $query .= " rest of the query");

        (About 20 lines in all)

        Shelly




        "Shelly" <sheldonlg.news @asap-consult.com> wrote in message
        news:CImdnVmIcL IbokXfRVn-jA@comcast.com. ..[color=blue]
        >
        > "Shelly" <sheldonlg.news @asap-consult.com> wrote in message
        > news:OsadnfvxuI Q5o0XfRVn-hA@comcast.com. ..[color=green]
        >>
        >> "Peter Butler" <peterbutler@ia frica.com> wrote in message
        >> news:Ku-dneUrvbgspEXfRV n-3A@is.co.za...[color=darkred]
        >>> 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???[/color]
        >>
        >> Off the top of my head, I would use a bitwise logical to find the value.
        >> E.G.
        >>
        >> $target = 0;
        >> if ($a == a) $target = $target | 1;
        >> if ($b == a) $target = $target | 2;
        >> if ($c == a) $target = $target | 4;
        >> if ($d == a) $target = $target | 8;
        >>
        >> and so on.
        >>
        >> Then I would do a header("Locatio n: theFile_" . $target . ".php");
        >>
        >> and you can have as many small files to do as many little things as you
        >> want. Then, any given file is small and easily processed.
        >>
        >> Just off the top of my head. It might or might not work.
        >>
        >> Shelly[/color]
        >
        > Or rather than having a zillion small files (many of which probably do the
        > same thing), you could simply have a switch statement and group numbers
        > that do the same thing.
        >
        > switch ($target) {
        > case 1: stuff
        > break;
        > case 2:
        > }
        >
        > Shelly
        >
        > Shelly
        >[/color]


        Comment

        • Shelly

          #5
          Re: Anoying problem with multi $var combinations Pse help..


          "Shelly" <sheldonlg.news @asap-consult.com> wrote in message
          news:Xa6dnR9zVN 973UXfRVn-1w@comcast.com. ..[color=blue]
          > More off the top of my head: Here is an example:
          >
          > $query = "select ";
          > if ($_POST('a') == a) $query . "$a set stuff with a comma at the end";[/color]

          This should have read:
          if ($_POST('a') == a) $query .= "$a set stuff with a comma at the end";

          [color=blue]
          > ....repeat for all.....
          > ....remove the last comma...
          > $query .= " rest of the query");
          >
          > (About 20 lines in all)
          >
          > Shelly
          >
          >
          >
          >
          > "Shelly" <sheldonlg.news @asap-consult.com> wrote in message
          > news:CImdnVmIcL IbokXfRVn-jA@comcast.com. ..[color=green]
          >>
          >> "Shelly" <sheldonlg.news @asap-consult.com> wrote in message
          >> news:OsadnfvxuI Q5o0XfRVn-hA@comcast.com. ..[color=darkred]
          >>>
          >>> "Peter Butler" <peterbutler@ia frica.com> wrote in message
          >>> news:Ku-dneUrvbgspEXfRV n-3A@is.co.za...
          >>>> 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???
          >>>
          >>> Off the top of my head, I would use a bitwise logical to find the value.
          >>> E.G.
          >>>
          >>> $target = 0;
          >>> if ($a == a) $target = $target | 1;
          >>> if ($b == a) $target = $target | 2;
          >>> if ($c == a) $target = $target | 4;
          >>> if ($d == a) $target = $target | 8;
          >>>
          >>> and so on.
          >>>
          >>> Then I would do a header("Locatio n: theFile_" . $target . ".php");
          >>>
          >>> and you can have as many small files to do as many little things as you
          >>> want. Then, any given file is small and easily processed.
          >>>
          >>> Just off the top of my head. It might or might not work.
          >>>
          >>> Shelly[/color]
          >>
          >> Or rather than having a zillion small files (many of which probably do
          >> the same thing), you could simply have a switch statement and group
          >> numbers that do the same thing.
          >>
          >> switch ($target) {
          >> case 1: stuff
          >> break;
          >> case 2:
          >> }
          >>
          >> Shelly
          >>
          >> Shelly
          >>[/color]
          >
          >[/color]


          Comment

          • Peter Butler

            #6
            Re: Anoying problem with multi $var combinations Pse help..


            Shelly <sheldonlg.news @asap-consult.com> wrote in message
            news:CImdnVmIcL IbokXfRVn-jA@comcast.com. ..
            [color=blue]
            > switch ($target) {
            > case 1: stuff
            > break;
            > case 2:
            > }[/color]


            ja... I know BUT I'll still have a zillion unique combinations of:

            14things x 14things x 14things x 14things x 14things x 14things x 14things x
            14things x 14things x 14things x 14things x 14things x 14things x 14things

            that's a lot of redundant

            'case "x": stuff_a




            .... unless that one single combination of 14 different $vars is set in that
            particular way


            Comment

            • Shelly

              #7
              Re: Anoying problem with multi $var combinations Pse help..


              "Shelly" <sheldonlg.news @asap-consult.com> wrote in message
              news:ydCdnXbU8-7Q3EXfRVn-gQ@comcast.com. ..[color=blue]
              >
              > "Shelly" <sheldonlg.news @asap-consult.com> wrote in message
              > news:Xa6dnR9zVN 973UXfRVn-1w@comcast.com. ..[color=green]
              >> More off the top of my head: Here is an example:
              >>
              >> $query = "select ";
              >> if ($_POST('a') == a) $query . "$a set stuff with a comma at the end";[/color]
              >
              > This should have read:
              > if ($_POST('a') == a) $query .= "$a set stuff with a comma at the end";[/color]

              Rather: if ($_POST['a'] == a) $query .= "$a set stuff with a comma at the
              end";



              Comment

              • Shelly

                #8
                Re: Anoying problem with multi $var combinations Pse help..


                "Peter Butler" <peterbutler@ia frica.com> wrote in message
                news:rbidnYj81a aV3kXfRVn-rA@is.co.za...[color=blue]
                >
                > Shelly <sheldonlg.news @asap-consult.com> wrote in message
                > news:CImdnVmIcL IbokXfRVn-jA@comcast.com. ..
                >[color=green]
                >> switch ($target) {
                >> case 1: stuff
                >> break;
                >> case 2:
                >> }[/color]
                >
                >
                > ja... I know BUT I'll still have a zillion unique combinations of:
                >
                > 14things x 14things x 14things x 14things x 14things x 14things x 14things
                > x
                > 14things x 14things x 14things x 14things x 14things x 14things x 14things
                >
                > that's a lot of redundant
                >
                > 'case "x": stuff_a
                >
                >
                >
                >
                > ... unless that one single combination of 14 different $vars is set in
                > that
                > particular way
                >[/color]

                See my last suggestion of simply building the query dynamically. Much
                shorter and much better.

                Shelly


                Comment

                Working...