I have a results table which I iterate over and then echo out.
$c = 1;
foreach ($results as $result) {
$r .= '<tr>'
. '<th scope="row">' . ($time === $result['time']? $c - 1 : $c) . '</th>'
. '<td>' . $result['name'] . '</td>'
. '<td>' . $result['time'] . ' </td>'
. '<td>' . $result['points'] . ' </td>'
. '</tr>';
$time = $result['time'];
$c++;
}
I compare the current time with the previous result time and display the count the same if they match.
e.g.
1. Tom 0.33
2. Ben 0.34
2. Carl 0.34
4. Des 0.35
5. Dave 0.36
But what if Des had also got 0.34? It would display count 3 and it should stay on 2.
Any ideas how to solve this without getting too complex?