Something like the following should work.
<?php
$sql = "SELECT * FROM game";
$result = mysql_query($sql)or die(mysql_error());
while ($row = mysql_fetch_array($result)){
// Show images
if($row['sport_cat']=='football'){
print "<img src='football.png'/>";
}
elseif($row['sport_cat']=='basketball'){
print "<img src='basketball.png'/>";
}
elseif($row['sport_cat']=='tennis'){
print "<img src='tennis.png'/>";
}else{
print "<img src='unknown.png' />";
}
} // End while loop
?>
Comments
Post a Comment