PDA

View Full Version : How to say 'If NoMore then Don'tDoThis'?


zonkd
08-30-2005, 10:13 AM
Is there a way to say that I don’t want “|” to appear after the last row, please, Experts? This is for the site's global navigation.

"SELECT CONCAT('<li> <a href=\"', Link, '\">', Named, '</a> &nbsp; | &nbsp; </li>') AS gn FROM GlobalFront ORDER BY GlobID"

NancyJ
08-30-2005, 10:21 AM
I think this would be better in the SQL forum but personally I wouldnt do it the way you're doing it...
I would do a 'normal' SQL select then process the data in php so I can do what I like with it.. eg.


$rownum = 0;
while($row = mysql_fetch_array($result)){
$rownum ++;
extract($row)
echo "<li><a href = \"$Link\">$Named</a>";
if ($rownum != mysql_num_rows($result)){
echo "&nbsp; | &nbsp";
}
echo "</li>";


I'm not saying its the best way to do it, but its how I would do it.