[Pugged] Switch Troubles

Chris Van Cleve ciapug@ciapug.org
Mon, 24 Mar 2003 14:02:11 -0500


I wrote the following code to change the background color of every 
other line in a table. For some reason, only the default color is ever 
assigned. Any ideas?

<?php while (!$result3->EOF) {
   		for ($i=0; $i < $max; $i++);
			$last2 = $str{strlen($i)-1}; 
			switch ($last2) { 
			case "1":
			case "3":
			case "5":
			case "7":
			case "9":
			    $bgcolor = "#e1e1e1";
				break;
			default:
			    $bgcolor = "#f5f5f5";
			} ?>
		  <tr bgcolor="<?= $bgcolor ?>">
		  <td><?= $result3->fields['team_name'] ?></td>
		  <td><?= $result3->fields['team_position'] ?></td>
		  <td><?= $result3->fields['team_phone'] ?></td>
		  <td><?= $result3->fields['team_email'] ?></td>
		  </tr>
      <?php $result3->MoveNext();
	  } ?>

-- 
Chris 'Vanish' Van Cleve
CEO, President, Founder
DreamScape Visionery