Issue
I have a question, I want to change string data from database using explode, because the data is imploded before when I post it to the database. Here's my controller
public function add_detail()
{
$symptoms_id = implode(',', $this->input->post('symptoms_id'));
$CF_user = implode(',', $this->input->post('CF_user'));
$data = array(
'symptoms_id' => $symptoms_id,
'CF_user' => $CF_user
);
$this->db->insert('consultation_detail', $data);
redirect('User/consultation_result', $data);
}
That function is to implode and it works, but I want to make a function in controller too for explode the data.
I just try like this
public function consultation_result()
{
$data['consultation_detail'] = $this->db->get('consultation_detail')->row();
$CF_user = explode(',', $CF_user);
}
But it said undefined $CF_user , I'm sorry because I'm newbie :(
Solution
try this
public function consultation_result($data)
{
return explode(',', $data);
}
and use like this
$data = array(
'symptoms_id' => consultation_result($this->input->post('symptoms_id')),
'CF_user' => consultation_result($this->input->post('CF_user'))
);
Answered By - AGK
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.