I have created a links directory script. On the main categories I am wanting to show 4 sub categories. E.G:
Main Category
This is the description...
Sub Cat 1, Sub Cat2, Sub Cat 3, Sub Cat 4 ...
All this information of the categories are stored in a mysql database.
What I need help with is getting the commas in between the sub cats... I could just use this:
Code: Select all
<?php
$subcats .= "<a href="cat.php?cat=$cat">$catname</a>, ";
?>How would I get commas on only the first 3 and not the forth?
Thanks