Welcome Guest, Not a member yet? Register   Sign In
Best way for checking true result
#1

[eluser]someone Smile[/eluser]
Hello,

What's the best way for checking if some method in model or anywhere else was correctly carried out?

Is this a good way?

Model:
Code:
$data['field1'] = $this->input->post('field1');
$data['field2'] = $this->input->post('field2');
$data['field3'] = $this->input->post('field3');

if ($this->db->insert('table', $data))
{
   return TRUE;
}
else
{
   return FALSE;
}

Controller:
Code:
if ($this->form_validation->run() == FALSE)
{
    $this->load->view('page_view', $data);
}
else
{
    if ($this->Model->Insert_data())
    {
       $this->session->set_flashdata("insertsuccess", TRUE);
    }
    else
    {
       $this->session->set_flashdata("inserterror", TRUE);
    }
    $this->load->view('page_view', $data);
}

Thanks for answers! :-)


Messages In This Thread
Best way for checking true result - by El Forum - 05-07-2012, 09:02 AM
Best way for checking true result - by El Forum - 05-07-2012, 12:17 PM
Best way for checking true result - by El Forum - 05-07-2012, 04:24 PM
Best way for checking true result - by El Forum - 05-07-2012, 08:24 PM
Best way for checking true result - by El Forum - 05-08-2012, 06:14 AM
Best way for checking true result - by El Forum - 05-08-2012, 06:18 AM
Best way for checking true result - by El Forum - 05-08-2012, 06:51 AM
Best way for checking true result - by El Forum - 05-08-2012, 08:56 AM
Best way for checking true result - by El Forum - 05-08-2012, 11:35 AM
Best way for checking true result - by El Forum - 05-27-2012, 10:14 AM
Best way for checking true result - by El Forum - 05-27-2012, 10:28 AM
Best way for checking true result - by El Forum - 07-03-2012, 12:05 PM
Best way for checking true result - by El Forum - 07-26-2012, 11:22 AM
Best way for checking true result - by El Forum - 07-26-2012, 11:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB