Echo a comma on all but the last value? (result from mysql_fetch_array)

后端 未结 11 2006
隐瞒了意图╮
隐瞒了意图╮ 2020-12-21 22:56

How do I echo a comma on all but the last value? Here\'s my code:

while ($servdescarrayrow = mysql_fetch_array($servdescarray)) {

    ECHO $servdescarrayrow         


        
11条回答
  •  心在旅途
    2020-12-21 23:34

    $count = 0;
    while ($servdescarrayrow = mysql_fetch_array($servdescarray)) {
        if ($count++ > 0) echo ",";
        echo $servdescarrayrow['serv_desc'];
    }
    

提交回复
热议问题