i have a list of categories spit out from my db. the list items all have a class on them applying a
underline to them...problem is i dont want the underline on the last list item....how do i do this? ive tried a
for loop in my code but, of course, it doesnt work because it just iterates through all of the list items. What i want to say is print out the list items with this
class until you get to the last list item...when you're on the last list item use this class ( without the underline)...any ideas how to do this?

Heres the code as it is with me trying to get it working with the for loop:

Code PHP:
$sql = "SELECT * FROM services order by serviceID";
$result = mysql_query($sql);
$no = mysql_num_rows($result);
while($row = mysql_fetch_assoc($result)){
for($i = 0; $i < $no; ++$i) {
?><li><a href="services_detail.php?s=<?php echo $row['name']; ?>"><?php echo $row['displayname']; ?></a></li><?php
if($i == $no) { ?>
<li><a style="color: red;" href="services_detail.php?s=<?php echo $row['name']; ?>"><?php echo $row['displayname']; ?></a></li>