title: comma separated list in php
body: <p>I am trying to build a list separated by commas which should look like this (green, orange, red).</p>
  
  <pre><code>$i=0;
  $taxonomy = $form_state[values][taxonomy][5];
  foreach ($taxonomy as $key =&gt; $value){
    $result = db_query("SQL CODE goes here");
    if (mysql_num_rows($result)){     
    while ($i&lt;mysql_num_rows($result)){
      $resultset = db_fetch_array($result);
      $comma_separated = implode(",", $resultset);
      $i++;      
    }
    form_set_error("Date", t("$comma_separated. cannot be booked more than once "));
  }
  </code></pre>