[eluser]dianikol85[/eluser]
Hi to all.
i have the following. A short version of the actual code but it will give you the idea
Code:
class my_controller extends CI_Controller {
private $message = '';
function index() {
$data['message'] = $message;
$this->load->view('my_view',$data);
}
function add_to_the db() {
$this->load->model(mytable_model);
$this->mytable_model->do_the_insert();
$message = 'success message';
$this->index();
}
}
So far so good. But when the $this->index(); is called it two rows in the db instead of one
if i use redirect('my_controller/index') or if commenting out this line
it adds one row as it should.
Does it happen to anyone else???
I dont want to use the redirect function beacause i also i pass a message to the index that the insert is success.