title: Remove last Comma from while loop
body: <p>My code is resulting in a output like this</p>
  
  <p>Title1,1,Title2,2,</p>
  
  <p>How can i remove the last comma from this?</p>
  
  <pre><code>$comma = ",";
  
  $query = "SELECT name, listid FROM playlist ORDER BY id DESC";
  $result = $mysqli-&gt;query($query);
  
  while(list($name, $listid) = $result-&gt;fetch_row()) {
      echo $name;
      echo $comma;
      echo $listid;
  echo $comma;
  }
  </code></pre>