put comma after values but not for last one
<p>I am just a beginner in php. I used the following code to display the user names fetched from the database.</p>

<pre><code>$select_tl = "SELECT `varTeamleader` FROM `tbl_team` WHERE `intTeamid` = '" . $id . "'";
$select_tl_res = mysql_query($select_tl);
$select_tl_num = mysql_num_rows($select_tl_res);
if ($select_tl_num &gt; 0) {
    $fetch_tl = mysql_fetch_array($select_tl_res);
    $tl = $fetch_tl['varTeamleader'];
    $sep_tl = explode(",", $tl);
    foreach ($sep_tl as $key =&gt; $value) {
        $sel_tlname = "SELECT * FROM `tbl_user` WHERE `intUserid` = '" . $value . "'";
        $sel_tlname_res = mysql_query($sel_tlname);
        $sel_tlname_num = mysql_num_rows($sel_tlname_res);
        if ($sel_tlname_num &gt; 0) {
            $fetch_username = mysql_fetch_array($sel_tlname_res);
            $user_name = $fetch_username['varName'];
            echo $user_name . ", ";
        }
    }
}
</code></pre>

<p>I need to echo the user_name with comma after every value but not after last one. How can i do that?</p>
