[eluser]kidego32[/eluser]
Hello,
I have a $data['result'] in my controller that was generated from a $query->result() in my model. I have a date field inside my result set that I'd like to split into the month, day, and year before passing it to the view.
I am able to access the field and split it, but I'm at a loss as to how to add the newly split fields back to the $data['result'] in order to pass it to the view.
Code:
$data['result'] = $this->Customers_model->get();
// Split up the date into the month, day, and year
$arr=split("-",$data['result']->dob); // split the array
$year=$arr[0]; // first element of the array is year
$month=$arr[1]; // second element is month
$day=$arr[2]; // third element is day
// Add these new values to the $data['result'] array
$this->load->view('customers/update_view',$data);
Does anyone know how I can add the $year, $month, and $day variables to the $data['result'] set?