⚠ 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

adding another parameter in a callback function



mbmtnez
  • profile picture
  • Member

Posted 20 June 2017 - 16:41 PM

hi, I know that this question was ask a lot of time, but i do not find an answer that solve my problem.

 

I need pass another parameter in a callback function, or at least bring a value into my callback function. This is what I have in my controller

function Test (){$operacion = 'Insertada traza';
 //   $this->crud->callback_after_insert(array($this, 'insert_traza'),$operacion);// I tried with this and do not work


$this->crud->callback_after_insert(array($this, 'insert_traza['.$operacion.']'));   // I tried with this and do not work
            }

 public function insert_traza($post_array, $primary_key ) {
    $operacion = $this->input->post('operacion'); 


  $this->db->insert('about', array(
            "id_about" => $primary_key,
                 'descrip' => $operacion
             
        ));
     
        return true;
    }

the primary key was insert ok in the respective table, and insert a "0" in the descrip field in my database, if I change the field the value "0" is inserted in that other field.

 

 

¿How can I get a value and insert it in my table?

 

Thanks in advance


xheradon
  • profile picture
  • Member

Posted 22 June 2017 - 07:41 AM

Try $this->your_variable = "your variable" and then accessing inside your callback $this->your_variable;


mbmtnez
  • profile picture
  • Member

Posted 27 June 2017 - 13:59 PM

Sorry for answer later BUT WORKS, thank´s so much. Now, I do not know how put the question like answered