I hope you had a nice Christmas.
It turns out that I have a table called votes with the following fields:
id , option , name , mail , rut , cond1 , cond2 , date
is a voting system then when voting is saved in the db the ID
and the opcion
later if you want the individual is registered and for that I need a INSERT name, run .. WHERE ID = ID
try with this code: model
function InsertRegistro($id,$data){
$this->db->insert('votaciones',$data);
$this->db->where("id",$id);
}
from my controller:
public function registro() {
$id = $this - > input - > post('id');
$data = array(
'nombre' => $this - > input - > post('nombre'),
'correo' => $this - > input - > post('correo'),
'rut' => $this - > input - > post('rut'),
'cond1' => $this - > input - > post('cond1'),
'cond2' => $this - > input - > post('cond2'),
);
$this - > load - > model('Prontomodel');
$this - > Prontomodel - > InsertRegistro($id, $data);
}
I insert data but I delete the id and then it does not let me insert, something I'm doing wrong, the thing is that I'm learning codeigniter and I would appreciate it if you could teach me how to do it, thanks.