PHP Code:
<?php
$scores = array(
array(69, 78, 72, 90, 88, 70, 66),
array(69, 78, 72, 90, 88, 70, 66),
array(69, 78, 72, 90, 88, 70, 66),
array(69, 78, 72, 90, 88, 70, 66),
);
function scoreClass($score) {
return $score < 72 ? 'below' : ($score > 72 ? 'above' : 'par');
}
?>
<html>
<head>
<style>
.below { color: red; }
.par { color: blue; }
.above { color: black; }
</style>
</head>
<body>
<table>
<?php foreach($scores as $scoresArray): ?>
<tr>
<?php foreach($scoresArray as $score): ?>
<td class="<?= scoreClass($score) ?>"><?= $score; ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</table>
</body>
</html>
This is just to get you started. You will need to put the function into your page. Then you'll need to call it in the loop you are using to build all your table rows.
Your loop is going to be a little complicated as you don't want to be placing class="par" in the td tags that hold the rank or person's name.
The css you have is a huge mess. You should move all of it to an external file. Instead of putting css into every td tag, you can put one line either in the page head section or an external file, etc...
EDIT: I just read the part of your post where you say that you are not a coder, which might mean you are a designer? If that is the case and you don't have any interest in coding, you probably should find/hire someone to do the php. I could see this getting pretty complicated for you as the example I gave is not going to get you very far if you don't have any coding experience or aren't interested in coding. If you are interested in coding and learning, that is something entirely different. If this is the case, then keep asking your questions.
Bookmarks