I can do either, but not both together, and there must be a way!
I have created a tagging system, the tags are entered as a comma separated list, and I currently retrieve and display the tags like so:
$query = "SELECT pTags FROM tablename WHERE pID = whatever";
$result = mysql_query ($query);
$row = mysql_fetch_array($result);
$list = $row;
$tags = explode(',', $list);
foreach ($tags AS $tags)
echo "<a href=\"/tags.php?tag=$tags\">$tags</a>, ";
Which works fine, except of course I have a trailing comma and space.
I know I can print them out if I just needed the (unlinked) list using
$tags = substr($list, 0, -2);
But how can I do both?