從多選擇如何插入數據在MySQL從多選擇在MySQL中如何插入數據
或作出這樣的字符串數組 - > ...
$arr =array('a'=>'1','b'=>'3','c'=>'5');
出來放像 1,3,5 將所有值插入一列,如 $ sth = $ this-> db-> prepare(「UPDATE data
SET category = $ arr where id = 1」);
<div class="control-group">
<label for="area" class="control-label">Rank</label>
<div class="controls">
<input type="number" name="rank" id="area" value="<?= $this->detali->rank ?>" />
</div>
</div>
<div class="control-group">
<label for="artist " class="control-label">Artist</label>
<?php
$art = explode(',', $this->detali->artist);
?>
<div class="controls">
<select multiple="multiple" id="my-select" name="artist[]" class='multiselect'>
<?php
foreach ($this->artist as $artist) { ?>
<option value="<?= $artist->artist_id ?>" <?php
foreach ($art as $value) {
if (!(strcmp("$artist->artist_id", htmlentities($value, ENT_COMPAT, 'utf-8')))) {
echo "SELECTED";
}
}
?>><?= $artist->artist_name ?></option>
<?php } ?>
</select>
</div>
</div>
如何從$_POST['artist'] (artist[])
like 1,5,6
不是陣列