title: Remove last comma from string in while loop
body: <p>My select query is like this, in group_name i am giving comma but I want to remove comma from last. I already tried with trim but it removes all commas, and I want to remove last comma only.</p>
  
  <pre><code>$selctGroup = "SELECT contact_id,group_name FROM contact_group
                         LEFT JOIN `group` ON `group`.`group_id` = `contact_group`.`group_id`
                   WHERE contact_id = ".$row['contact_id'];
   $selctGroupRes = mysql_query($selctGroup);
   while($groupRow = mysql_fetch_array($selctGroupRes))
   {
     echo  $groupRow['group_name'].','; 
   }
  </code></pre>