First of all, this makes no sense:
Code:
$rows['date'] = date( "d/m/Y", $rows['date_ts'] );
...
<td nowrap><? echo $rows['datefield']; ?></td>
You create a new element in the array--"date"--but then never use it. Instead, you use something called "datefield"??? What is going on?
*********
Another way to do this, though, would be to enhance your SQL query. And in the process get rid of the need to convert the date in PHP.
You don't bother to show that to us, but just as an example (and guessing about your date vs. datefield funniness):
Code:
SELECT DATE_FORMAT(date_ts,'%d/%m/%Y') AS datefield,
datefield, shift, reason, person_covering, cost,
IF ( staff_approved LIKE 'yes%', 'yes', 'no' ) AS doEdit
FROM yourtable
WHERE ...
My "doEdit" may be backwards. If so, just swap the 2nd and 3rd arguments of the if.
Then, in the PHP code:
Code:
<?php
while($rows=mysql_fetch_array($result))
{
?>
<tr>
<td nowrap><?php echo $rows['datefield']; ?></td>
<td nowrap><?php echo $rows['shift']; ?></td>
<td nowrap> <?php echo $rows['reason'];?></td>
<td nowrap> <?php echo $rows['person_covering']; ?></td>
<td nowrap> £<?php echo $rows['cost']; ?></td>
<td nowrap><?php if($rows['doEdit'] == 'yes')
{
?>
<a href="updaterecord.php?id=<?php echo $rows['id'];?>">Edit</a>
<?php
}
?>
</td>
</tr>
<?php
}
?>