title: PHP Loop, Add a comma after every loop except the last
body: <p>I've got a query that loops through some product names and puts them down on the page.  As part of the loop, it adds a comma to the end, so it looks like this:</p>
  
  <p>Products:  Shirts, Pants, Ties, Jackets, </p>
  
  <p>Notice that I'm getting a comma after the last product.  Also, they are all links, so I can't use some strreplace fx or similar:</p>
  
  <p>Here's my code:</p>
  
  <pre><code>&lt;?php
   $product_query = mysql_query("select * from products_table);
   $row_product_query = mysql_fetch_assoc($product_query);
   $totalRows_product_query = mysql_num_rows($product_query);
   ?&gt;
   &lt;strong&gt;Products:  &lt;/strong&gt;
   &lt;?php if ($totalRows_product_query &gt; 0) {  ?&gt;
   &lt;?php do { ?&gt;
   &lt;span&gt;&lt;a href="link"&gt;&lt;?php echo $row_product_query['products_name']; ?&gt;&lt;/a&gt;&lt;/span&gt;
  &lt;strong&gt;,&amp;nbsp;&lt;/strong&gt;
   &lt;?php } while ($row_product_query = mysql_fetch_assoc($product_query)); ?&gt;
   &lt;?php } ?&gt;&lt;br /&gt;
  </code></pre>
  
  <p>What do I need to do to make that last comma not appear?</p>
  
  <p>Thanks in advance as always.</p>