⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠


profile picture

Not understand function of callbackafterinsert and callbackafterupdate


  • profile picture
  • Member

Posted 22 September 2020 - 21:54 PM

Hi, My name is Jose Angel y have problem, not understand function of  of callbackafterinsert and callbackafterupdate, i see examples in the grocery enterprise, i copy and paste and modify parameters, not function, in  version free grocery crud is easy.


The real problem is that in table update all fields of rows, only update only row. 





$crud->callbackAfterInsert(function ($stateParameters) {
    $this->db->where('iddelitosporcaso', $stateParameters->insertId);
    $delitosporcaso = $this->db->get('delitosporcaso')->row();
    if (!empty($delitosporcaso)) {
            ['idusuarios' =>  $this->uri->segment(4)],
            ['iddelitosporcaso' => $stateParameters->insertId]]);
    return $stateParameters;



  • profile picture
  • Member

Posted 28 September 2020 - 16:15 PM

Buenas tardes Jose Ángel,


si he entendido bien te falta un where a la hora de hacer el update, si no, lo hará de forma general en la tabla. De igual manera te recomiendo utilizar un modelo en el cual se hagan las llamadas a base de datos desde ahí.


Por ponerte un ejemplo de lo que tú quieres hacer:

	function update_password($id, $password){
		$data = array(
        'password' => $password
		$this->db->update('users', $data);

Un saludo.