while loop - how to remove last comma
I have a while loop that lists all manufacturers that we sell and each is seperated like this: , so that there is a comma and a blank space seperating each one. Is there a way to remove the comma after the last one?
Here is my script:
<?php
include 'xxxxxx.php';
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection.");
//List for brands carried
$manufacturers = mysql_query("SELECT * FROM manufacturers ORDER BY manufacturers_name ASC") or die(mysql_error());
while ($rrows = mysql_fetch_array($manufacturers)) { ?>
<a href="shop/index.php?main_page=index&manufacturers_id=<?php echo $rrows['manufacturers_id']?>"><?php echo $rrows['manufacturers_name']?></a>,
<?php } ?>
Thanks,
Clint
Subject
Written By
Posted
while loop - how to remove last comma
November 30, 2012 07:48PM
November 30, 2012 08:33PM
November 30, 2012 08:40PM
November 30, 2012 10:33PM
November 30, 2012 11:06PM
December 01, 2012 04:34PM
December 02, 2012 02:56PM
December 03, 2012 07:49PM
December 01, 2012 11:22AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.