hello guys . im soory i
m asking again …
i had this trouble since this morning …
i want to save an array into a model that i get from multiple field
if(isset($_POST['komponent'])){
//print_r($_POST['komponent']); [i]// [0] => a [1] => b [/i]
$mod = array("komponent" => $_POST['komponent']);
print_r($mod); [i]//Array ( [komponent] => Array ( [0] => a [1] => b ) ) [/i]
$modelb->attributes= $mod;
$modelb->save();
}
i tried to input this with an array into field named komponent
i had tried to save with more declare in model like this
$modelb->attributes['komponent'] = $mod;
when i see in database my field fulled with "array" not the data i tried to store …
oh yea . i had tried this one too …
i thougt when looping it will store manualy one by one
if(isset($_POST['komponent'])){
print_r($_POST['komponent']);
foreach ($_POST['komponent'] as $newkomponent):
$baru = array('komponent'=>$newkomponent);
$modelb->attributes = $baru;
$modelb->save();
endforeach;
print_r($baru);
need you`r help