title: how insert data from multi select in mysql
body: <p>how insert data from  multi select in mysql</p>
  
  <p>or make array  string like ->...</p>
  
  <pre><code> $arr =array('a'=&gt;'1','b'=&gt;'3','c'=&gt;'5');
  </code></pre>
  
  <p>out put like 
  1,3,5
  to insert all values in one column like
  $sth = $this->db->prepare("UPDATE <code>data</code> SET category = $arr  where id = 1");</p>
  
  <p></p>
  
  <pre><code>                &lt;div class="control-group"&gt;
                      &lt;label for="area" class="control-label"&gt;Rank&lt;/label&gt;
                      &lt;div class="controls"&gt;
                          &lt;input type="number" name="rank" id="area" value="&lt;?= $this-&gt;detali-&gt;rank ?&gt;" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
  
  
  
  
                  &lt;div class="control-group"&gt;
                      &lt;label for="artist " class="control-label"&gt;Artist&lt;/label&gt;
                      &lt;?php
                      $art = explode(',', $this-&gt;detali-&gt;artist);
                      ?&gt;
                      &lt;div class="controls"&gt;
                          &lt;select multiple="multiple" id="my-select" name="artist[]" class='multiselect'&gt;
                              &lt;?php 
                              foreach ($this-&gt;artist as $artist) { ?&gt;
                                  &lt;option value="&lt;?= $artist-&gt;artist_id ?&gt;" &lt;?php
  
                                              foreach ($art as $value) {
  
                                  if (!(strcmp("$artist-&gt;artist_id", htmlentities($value, ENT_COMPAT, 'utf-8')))) {
                                      echo "SELECTED";
                                  }                                                    
  
                                              }
  
                                  ?&gt;&gt;&lt;?= $artist-&gt;artist_name ?&gt;&lt;/option&gt;
                              &lt;?php } ?&gt;
                          &lt;/select&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;                    
  </code></pre>
  
  <p></p>
  
  <p>how to get data from <code>$_POST['artist'] (artist[])</code></p>
  
  <pre><code>like  1,5,6
  </code></pre>
  
  <p>not array</p>