Remove last comma or prevent it from being printed at all MySQL/PHP

前端 未结 3 436
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-24 10:36

I am printing a set of words that is placed in a MySQL database and I am retrieving it with PHP. I want to present it as a comma separated list, but I need it not to print or re

3条回答
  •  没有蜡笔的小新
    2021-01-24 11:00

    I would do:

    $keywords = array();
    while($row0 = mysql_fetch_array($result0, MYSQL_ASSOC))
    {
       $keywords[] = $row0['LCASE(ord)'];
    }
    
    echo implode(',', $keywords);
    

提交回复
热议问题