06-11-2012, 12:42 PM
[eluser]Dizza[/eluser]
[quote author="Glazz" date="1339442077"]After you submit your form, try using this code to see what you are exactly getting from the form:
or
Inside the foreach, you place your mysql query, but you need change the values of course, so it will be automatically.[/quote]
Haha thanks! Im almost there now
My model looks like this now
And my controller
When i used the var_dump all data was there but now i get this error, that while im not even updating
[quote author="Glazz" date="1339442077"]After you submit your form, try using this code to see what you are exactly getting from the form:
Code:
var_dump( $this->input->post() );
Code:
var_dump( $this->input->post('aanwezigheid') );
Inside the foreach, you place your mysql query, but you need change the values of course, so it will be automatically.[/quote]
Haha thanks! Im almost there now

My model looks like this now
Code:
function updateAanwezigheid($data)
{
foreach ( $this->input->post('aanwezigheid') as $ID => $aanwezigheid )
{
$this->db->insert('aanwezigheid', $data);
}
echo "Added";
return;
}
And my controller
Code:
function insert(){
$this->is_logged_in();
if($this->input->post('submit')){
$this->load->model('aanwezigheid_model');
$ID = $this->input->post('ID');
$lesuur = $this->input->post('lesuur');
$aanwezigheid = $this->input->post('aanwezigheid');
$this->aanwezigheid_model->updateAanwezigheid($data);
}
$this->load->view('aanwezigheidklas_view' );
}
When i used the var_dump all data was there but now i get this error, that while im not even updating

Code:
You must use the "set" method to update an entry.
Filename: /Users/jimmytenbrink/Sites/afstuderen/models/aanwezigheid_model.php
Line Number: 9