comma separated list in php

后端 未结 3 1706
独厮守ぢ
独厮守ぢ 2021-01-29 15:48

I am trying to build a list separated by commas which should look like this (green, orange, red).

$i=0;
$taxonomy = $form_state[values][taxonomy][5];
foreach ($t         


        
3条回答
  •  死守一世寂寞
    2021-01-29 16:39

    Try this:

    $i=0; 
    $taxonomy = $form_state[values][taxonomy][5]; 
    $result='';
    foreach ($taxonomy as $key => $value)
    { 
        $result = db_query("SQL CODE goes here"); 
        if (mysql_num_rows($result)){
            while ($row = mysql_fetch_row()){
               result.=$row[0].',';
            } 
        }
    }
    result=substr($result,0,-1);
    echo $result;
    

提交回复
热议问题