[eluser]RayDube[/eluser]
That was it, it was me trying to add the pos to the wrong array...
Now this works..
Code:
if($query->num_rows()>0)
{
foreach ($query->result_array() as $row)
{
$this->Points = $row['Points'];
$this->Wins = $row['Wins'];
if ($this->PrevPoints == $this->Points)
{
if ($this->PrevWins == $this->Wins)
{
$row['pos'] = $this->pos;
}
else
{
$this->pos++;
$row['pos'] = $this->pos;
}
}
else
{
$this->pos++;
$row['pos'] = $this->pos;
}
$this->PrevPoints = $this->Points;
$this->PrevWins = $this->Wins;
$data[]=$row;
}
$query->free_result();
return $data;
}
With the following changes to the view:
Code:
<?php foreach($records as $row) :?>
<tr>
<td><?php echo $row['pos']; ?></td>
<td><?php echo $row['Team_Name']; ?></td>
<td><?php echo $row['Wins']; ?></td>
<td><?php echo $row['Losses']; ?></td>
<td><?php echo $row['Ties']; ?></td>
<td><?php echo $row['Points']; ?></td>
Thanks very much for your help Ben, it is appreciated, even if I was blind at times...
Ray