Continuation of my previous question, which was resolved... I have this code in the model:
$this->db->select_max('ELDI_Orden');
$res = $this->db->get('elementos_diccionario')->row()->ELDI_Orden;
$eldi_key = url_title($this->input->post('eldi_key'), 'underscore', TRUE);
$eldi_orden = $res+1;
$datos = array(
'ELDI_Key' => $eldi_key,
'ELDI_Orden' => $eldi_orden,
'ELDI_Display' => $this->input->post('eldi_display'),
'ELDI_SuDiccionario' => $this->input->post('eldi_sudiccionario'),
);
$this->db->insert('elementos_diccionario', $datos);
But I need it to do that only when ELDI_SuDiccinario have different values:
Looking that image, I need the next ELDI_Orden (of ELDI_SuDiccionario 1) to be 5 and not 6.
ELDI_SuDIccionario ELDI_Orden
1 1
1 2
1 3
1 4
--NEW-- 1 --NEW-- 5
2 1
2 2
... ...
2 5
I hope you can understand me, my english is very bad.
Thanks for your time.