I have been working on a script to call information from a database and displayed this information in a table please see bellow code.
<?
$dbh=mysql_connect ("", "", "") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("");
$query = "SELECT * FROM membersorder by pilot_id ";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_assoc($result);
mysql_close();
/ Display results in a table /
echo "<table width='800' align='center' cellpadding='0' border='1' bordercolor='#000080'>";
echo "<tr>\n
<td width='150'bgcolor='#ffffff' bordercolor='#000080' style='font-weight: bold'style='text-decoration: none'><font color='#000080'>pilot_id</td>
<td width='150'style='font-weight: bold'><a href=$href style='text-decoration: none'><font color='#000080'>name</td>\n
<td width='100'style='font-weight: bold'style='text-decoration: none'><font color='#000080'>hours</td>\n
<td width='100'style='font-weight: bold'style='text-decoration: none'><font color='#000080'>hub</td>\n
<td width='100'style='font-weight: bold'style='text-decoration: none'><font color='#000080'>joindate</td>\n
<td width='100'style='font-weight: bold'style='text-decoration: none'><font color='#000080'>flights</td>\n
<td width='100'style='font-weight: bold'style='text-decoration: none'><font color='#000080'>last flight</td>\n
</tr>\n";
while ($colum = mysql_fetch_array($result))
extract($colum);
echo "<tr>\n
<td width='150'bgcolor='#ffffff' bordercolor='#000080' style='font-weight: bold'style='text-decoration: none'><font color='#000080'>$pilot_id</td>
<td width='150'style='font-weight: bold'><a href=$href style='text-decoration: none'><font color='#000080'>$name</td>\n
<td width='100'style='font-weight: bold'style='text-decoration: none'><font color='#000080'>$hours</td>\n
<td width='100'style='font-weight: bold'style='text-decoration: none'><font color='#000080'>$hub</td>\n
<td width='100'style='font-weight: bold'style='text-decoration: none'><font color='#000080'>$joindate</td>\n
<td width='100'style='font-weight: bold'style='text-decoration: none'><font color='#000080'>$flights</td>\n
<td width='100'style='font-weight: bold'style='text-decoration: none'><font color='#000080'>$date</td>\n
<td width='100'style='font-weight: bold'style='text-decoration: none'><font color='#000080'></td>\n
</tr>\n";
}
echo "</table>\n";?>
what i would like to do is actually show and image in this table but based upon a rank structure using the if command and get this to output a different image according to the actual data returned from within mysql datbase if command example bellow.
if ($row['hours']<="5")
{ echo '<img src="1.gif" width="70" height="30"> '; }
else
if ($row['hours']>="3000")
{ echo '<img src="10.gif" width="70" height="30"> '; }
else
if ($row['hours']>="2000")
{ echo '<img src="9.gif" width="70" height="30"> '; }
else
if ($row['hours']>="1000")
{ echo '<img src="8.gif" width="70" height="30"> '; }
else
if ($row['hours']>="500")
{ echo '<img src="7.gif" width="70" height="30"> '; }
else
if ($row['hours']>="100")
{ echo '<img src="6.gif" width="70" height="30"> '; }
else
if ($row['hours']>="50")
{ echo '<img src="5.gif" width="70" height="30"> '; }
else
if ($row['hours']>="30")
{ echo '<img src="4.gif" width="70" height="30"> '; }
else
if ($row['total']>="10")
{ echo '<img src="3.gif" width="70" height="30"> '; }
else
if ($row['hours']>="5")
{ echo '<img src="2.gif" width="70" height="30"> '; }
so for example if you had 100 it would display a different image to say if you had 50 hours and so on and so fourth in the same table as the other information being pulled from the mysql db.
I am fairly new to php but am getting to grips with it any help would be appreciated here. this has had me stumped for weeks I have looked around the website and am unable to locate any information to help.
Lee.