hiya
I'd like to optimize a code snippet I wrote:
------------------------------------------------------------------------
while ($Girl = each($Girls)){
$AttGirl = "Attitude$G irl[value]";
if ($$AttGirl && ("-" != $$AttGirl))
$query .= " AND (swimsuits.atti tude_" . strtolower($Gir l[value]) . " = '" . $$AttGirl . "')";
}
------------------------------------------------------------------------
It would be quite cool if I could drop the second line. But I don't know
how to tackle this.
$Girls is a simple array:
$Girls = array('Ayane',' Christie','Hele na','Hitomi','K asumi','Leifang ','Lisa','Tina' );
It's quite possible that I'm on the wrong track and there's a much
cleaner approach. The above code resulted from optimizing this:
------------------------------------------------------------------------
if ($AttitudeAyane && ("-" != $AttitudeAyane) )
$query .= " AND (swimsuits.atti tude_ayane = '$AttitudeAyane ')";
if ($AttitudeChris tie && ("-" != $AttitudeChrist ie))
$query .= " AND (swimsuits.atti tude_christie = '$AttitudeChris tie')";
[repeat for other girls]
------------------------------------------------------------------------
$AttitudeAyane is defined elsewhere an may hold no value or something
along the lines of -,0,1,2,3,4 or 5
tschüß
thomas
--
Music->Playing: In Strict Confidence - Herzattacke
Who am I? Am I the|As the silence fades away / I gather strength for another day
only me? I am the|Another day I've to go through / Another day here without you
only me... right? |-- "Another day", L´âme Immortelle
I'd like to optimize a code snippet I wrote:
------------------------------------------------------------------------
while ($Girl = each($Girls)){
$AttGirl = "Attitude$G irl[value]";
if ($$AttGirl && ("-" != $$AttGirl))
$query .= " AND (swimsuits.atti tude_" . strtolower($Gir l[value]) . " = '" . $$AttGirl . "')";
}
------------------------------------------------------------------------
It would be quite cool if I could drop the second line. But I don't know
how to tackle this.
$Girls is a simple array:
$Girls = array('Ayane',' Christie','Hele na','Hitomi','K asumi','Leifang ','Lisa','Tina' );
It's quite possible that I'm on the wrong track and there's a much
cleaner approach. The above code resulted from optimizing this:
------------------------------------------------------------------------
if ($AttitudeAyane && ("-" != $AttitudeAyane) )
$query .= " AND (swimsuits.atti tude_ayane = '$AttitudeAyane ')";
if ($AttitudeChris tie && ("-" != $AttitudeChrist ie))
$query .= " AND (swimsuits.atti tude_christie = '$AttitudeChris tie')";
[repeat for other girls]
------------------------------------------------------------------------
$AttitudeAyane is defined elsewhere an may hold no value or something
along the lines of -,0,1,2,3,4 or 5
tschüß
thomas
--
Music->Playing: In Strict Confidence - Herzattacke
Who am I? Am I the|As the silence fades away / I gather strength for another day
only me? I am the|Another day I've to go through / Another day here without you
only me... right? |-- "Another day", L´âme Immortelle
Comment