PHP Array

design

#1

I created a table to recognize specific players for donations. The table displays their game name and the title that they earned. I want to put in these star images to the left of their name in a separate column, but I can’t figure out how to do this. There are five different titles and a star image for each title. So if they are a Titanium Member, I would want the Titanium Star image to be to the left of their name.

Can anybody tell me how do to this? I’m not very well versed in PHP, but I’m trying to learn. Thanks!

Here’s the code :

[code]


<?php } echo "
	<p><div class='border_01'><table width='100%' border='0' cellpadding='3' cellspacing='0' align='center'>
      <tr class='tableHdr'>
          <td width='20'></td>
          <td width='200' align='left'>Recognized Player</td>
          <td colspan='2' align='left'>Earned Title</td>
        </tr>
<?php $d_player = array("Asseletion", "Bill_theButcher", "ShRaPnEl", "Dadfish", "Tyexan", "BeBop", "BMH", "DSR", "Gloch", "Smokin_Good", "MrGreen", "MVP", "Scorpion_Sting", "Patricking", "Thumbs"); $d_title = array("Titanium Member", "Titanium Member", "Titanium Member", "Platinum Member", "Platinum Member", "Gold Member", "Gold Member", "Gold Member", "Gold Member", "Gold Member", "Silver Member", "Silver Member", "Silver Member", "Bronze Member", "Bronze Member"); for ($i=1;$i<=15;$i++){ if ($loop==0){ $background="141414"; $loop=10; } else { $background="000000"; $loop=0;} ?>
<?php echo $i; ?> <?php echo $d_player[$i-1]; ?> <?php echo $d_title[$i-1]; ?>
These are players who deserve recognition for donating to the campaign that helped keep BA going and get on the path to better days. Special thanks to these players!
";[/code]

#2

This is how I would do the array. Or maybe include the file name for the rank image, then <img src="<?php $d_player["Thumbs"] ?>"/> would produce the Bronze Star (as an example).

Now that I look at the rest of your code, doing the array like this would make other things hard and require some re-working.


#3

Use a switch statement?
[php]switch (n)
{
case Titanium Member:
color star if = Titanium Member;
break;
case Platinum Member:
color star if = Platinum Member;
break;
blah blah blah
default:
code to be executed if n is different from member status;
}[/php]