Changing variable within while loop
<p>Instead of having code like the following:</p>

<pre><code>if ( $Boss1 ==1)
            {
                $Boss1_holder = $tick;
            }

            else if ( $Boss1 ==0)
            {
                $Boss1_holder = $cross;
            }



            if ( $Boss2 ==1)
            {
                $Boss2_holder = $tick;
            }
            else if ( $Boss2 ==0)
            {
                $Boss2_holder = $cross;
            }


            if ( $Boss3 ==1)
            {
                $Boss3_holder = $tick;
            }
            else if ( $Boss3 ==0)
            {
                $Boss3_holder = $cross;
            }


            if ( $Boss4 ==1)
            {
                $Boss4_holder = $tick;
            }
            else if ( $Boss4 ==0)
            {
                $Boss4_holder = $cross;
            }
</code></pre>

<p>Can i instead do something like this:</p>

<pre><code>                $i = 1;
            while ($i &lt;= 4) 
            {
                if ( $Boss[$i] ==1)
                {
                    $boss_holder[$i] = $tick;
                }

                else if ( $Boss[$i] ==0)
                {
                    $boss_holder[$i] = $cross;
                }

            }
</code></pre>

<p>I'm not entirely sure how to do it. At the moment if only have 4 sets of if else statements but my program later would require about 30 of them and i would rather having something like my second block that will reduce the amount of lines required. Am i on the right track. I think the $boss_holder[$i] part is incorrect as [i] would be part of an array? however i dont know how to write this correctly. I have looked on the php manual page but a lot of the examples are some what complex and go above the scope i need.</p>

<p>To clarify if i have explanined this poorly. I am trying to add a value onto the end of the variable $boss_holder that increments with the while loop counter</p>

<pre><code>    $Boss1_holder = '';
$Boss2_holder = '';
$Boss3_holder = '';
$Boss4_holder = '';
$Boss5_holder = '';
$Boss6_holder = '';
$Boss7_holder = '';
$Boss8_holder = '';
$Boss9_holder = '';
$Boss10_holder = '';
$Boss11_holder = '';
$Boss12_holder = '';
$Boss13_holder = '';
$Boss14_holder = '';
$Boss15_holder = '';
$completed1 = 0;
$completed2 = 0;
$completed3 = 0;
$counter = 0;
$tick ='&amp;nbsp;&lt;img src="/styles/subsilver2/theme/images/soap/tick.png"&gt;';
$cross ='&amp;nbsp;&lt;img src="/styles/subsilver2/theme/images/soap/cross.png"&gt;';
</code></pre>

<p>class checks 
{</p>

<pre><code>private $addthemup1;
private $addthemup2;
private $addthemup3;

public function checkBosses($Boss1, $Boss2, $Boss3, $Boss4, $Boss5, $Boss6, $Boss7, $Boss8, $Boss9, $Boss10, $Boss11, $Boss12, $Boss13, $Boss14, $Boss15)
{
    global  $tick, $cross, $completed1, $completed2, $completed3, $Boss1_holder, $Boss2_holder, $Boss3_holder, $Boss4_holder, $Boss5_holder, $Boss6_holder, $Boss7_holder, $Boss8_holder, $Boss9_holder, $Boss10_holder, $Boss11_holder, $Boss12_holder, $Boss13_holder, $Boss14_holder, $Boss15_holder;

    $addthemup1 = $Boss1 + $Boss2 + $Boss3 + $Boss4 + $Boss5;
    $addthemup2 = $Boss6 + $Boss7 + $Boss8 + $Boss9 + $Boss10;
    $addthemup3 = $Boss11 + $Boss12 + $Boss13 + $Boss14 + $Boss15;

    switch ($addthemup1)
            {
                case "5":
                $completed1 = $tick;
                break;

                case "4":
                $completed1 ='4/5';
                break;  

                case "3":
                $completed1 ='3/5';
                break;  

                case "2":
                $completed1 ='2/5';
                break;

                case "1":
                $completed1 ='1/5';
                break;  

                case "0":
                $completed1 ='0/5';
                break;  
            }
    switch ($addthemup2)
            {
                case "5":
                $completed2 = $tick;
                break;

                case "4":
                $completed2 ='4/5';
                break;  

                case "3":
                $completed2 ='3/5';
                break;  

                case "2":
                $completed2 ='2/5';
                break;

                case "1":
                $completed2 ='1/5';
                break;  

                case "0":
                $completed2 ='0/5';
                break;  
            }
    switch ($addthemup3)
            {
                case "5":
                $completed3 = $tick;
                break;

                case "4":
                $completed3 ='4/5';
                break;  

                case "3":
                $completed3 ='3/5';
                break;  

                case "2":
                $completed3 ='2/5';
                break;

                case "1":
                $completed3 ='1/5';
                break;  

                case "0":
                $completed3 ='0/5';
                break;  
            }




            if ( $Boss1 ==1)
            {
                $Boss1_holder = $tick;
            }

            else if ( $Boss1 ==0)
            {
                $Boss1_holder = $cross;
            }



            if ( $Boss2 ==1)
            {
                $Boss2_holder = $tick;
            }
            else if ( $Boss2 ==0)
            {
                $Boss2_holder = $cross;
            }


            if ( $Boss3 ==1)
            {
                $Boss3_holder = $tick;
            }
            else if ( $Boss3 ==0)
            {
                $Boss3_holder = $cross;
            }


            if ( $Boss4 ==1)
            {
                $Boss4_holder = $tick;
            }
            else if ( $Boss4 ==0)
            {
                $Boss4_holder = $cross;
            }


            if ( $Boss5 ==1)
            {
                $Boss5_holder = $tick;
            }
            else if ( $Boss5 ==0)
            {
                $Boss5_holder = $cross;
            }

            if ( $Boss6 ==1)
            {
                $Boss6_holder = $tick;
            }

            else if ( $Boss6 ==0)
            {
                $Boss6_holder = $cross;
            }

            if ( $Boss7 ==1)
            {
                $Boss7_holder = $tick;
            }
            else if ( $Boss7 ==0)
            {
                $Boss7_holder = $cross;
            }


            if ( $Boss8 ==1)
            {
                $Boss8_holder = $tick;
            }
            else if ( $Boss8 ==0)
            {
                $Boss8_holder = $cross;
            }


            if ( $Boss9 ==1)
            {
                $Boss9_holder = $tick;
            }
            else if ( $Boss9 ==0)
            {
                $Boss9_holder = $cross;
            }


            if ( $Boss10 ==1)
            {
                $Boss10_holder = $tick;
            }
            else if ( $Boss10 ==0)
            {
                $Boss10_holder = $cross;
            }

            if ( $Boss11 ==1)
            {
                $Boss11_holder = $tick;
            }

            else if ( $Boss11 ==0)
            {
                $Boss11_holder = $cross;
            }



            if ( $Boss12 ==1)
            {
                $Boss12_holder = $tick;
            }
            else if ( $Boss12 ==0)
            {
                $Boss12_holder = $cross;
            }


            if ( $Boss13 ==1)
            {
                $Boss13_holder = $tick;
            }
            else if ( $Boss13 ==0)
            {
                $Boss13_holder = $cross;
            }


            if ( $Boss14 ==1)
            {
                $Boss14_holder = $tick;
            }
            else if ( $Boss14 ==0)
            {
                $Boss14_holder = $cross;
            }


            if ( $Boss15 ==1)
            {
                $Boss15_holder = $tick;
            }
            else if ( $Boss15 ==0)
            {
                $Boss15_holder = $cross;
            }


}
</code></pre>

<p>}</p>

<p>$sql = 'SELECT * FROM <code>raid_progression</code>';</p>

<pre><code>$result = $db-&gt;sql_query($sql);

  while ($row = $db-&gt;sql_fetchrow($result))
  {      
            $counter = $counter+1;

            $checker1 = new checks();   
            $checkResult1 = $checker1-&gt; checkBosses($row['kp_em_no_bonethr'], $row['kp_em_no_foreman'], $row['kp_em_no_heavyfab'], $row['kp_em_no_jargsor'], $row['kp_em_no_kragga'],$row['kp_em_ha_bonethr'], $row['kp_em_ha_foreman'], $row['kp_em_ha_heavyfab'], $row['kp_em_ha_jargsor'], $row['kp_em_ha_kragga'],$row['kp_em_kn_bonethr'], $row['kp_em_kn_foreman'], $row['kp_em_kn_heavyfab'], $row['kp_em_kn_jargsor'], $row['kp_em_kn_kragga']);



            $template-&gt;assign_block_vars('raid_op', array(
            'VAR0' =&gt; $counter,
            'VAR1' =&gt; $row['guild_name'],
            'VAR2' =&gt; $row['guild_website'],
            'VAR3' =&gt; $row['server_name'],
            'VAR4' =&gt; $row['server_region'],
            'VAR5' =&gt; $row['faction_name'],
            'VAR6' =&gt; $completed1,
            'VAR7' =&gt; $Boss1_holder,
            'VAR8' =&gt; $Boss2_holder,
            'VAR9' =&gt; $Boss3_holder,
            'VAR10' =&gt; $Boss4_holder,
            'VAR11' =&gt; $Boss5_holder,
            'VAR12' =&gt; $Boss6_holder,
            'VAR13' =&gt; $Boss7_holder,
            'VAR14' =&gt; $Boss8_holder,
            'VAR15' =&gt; $Boss9_holder,
            'VAR16' =&gt; $Boss10_holder,
            'VAR17' =&gt; $Boss11_holder,
            'VAR18' =&gt; $Boss12_holder,
            'VAR19' =&gt; $Boss13_holder,
            'VAR20' =&gt; $Boss14_holder,
            'VAR21' =&gt; $Boss15_holder,
            'VAR22' =&gt; $completed2,
            'VAR23' =&gt; $completed3,
            ));






  }

  $db-&gt;sql_freeresult($result);
</code></pre>
