I know the reason why the error is coming I
$newarr = [];
if(count($_POST['dynamic_field'])){
foreach($_POST['dynamic_field'] as $key=>$value)
{
$this->db->query('ALTER TABLE tbl_order ADD '.$key.' varchar(255)');
$newarr[$key] =json_encode($value);
}
}
just want to know to logic.