[Solved] How to store array in table split by array_chunk in php? [closed]


You need to change your foreach to this to allow for the creation of new Model instance for each record set.

foreach ($matches as $value) {

    $share_holder_info = new ShareHolderInfo();
    $share_holder_info->trad_id = $rand_id;  
    $share_holder_info->name = $value[0]; 
    $share_holder_info->address = $value[1]; 
    $share_holder_info->shares = $value[2]; 
    $share_holder_info->save(); 

}

You will need to change it to what ever your actual Model is named.

I hope this helps

2

solved How to store array in table split by array_chunk in php? [closed]