⚠ 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

add a field value from code



Aimad Majdou
  • profile picture
  • Member

Posted 20 December 2013 - 17:26 PM

Hi there,

 

I have this table :

annonce (id, name, id_user).

the id_user is a foreign key which references to another table user(id,....).

 

I don't want to add the user_id in an input when I add an entry in the annonce table, I have the user_id in the session, so I want when I add a new entry to specify the user id in the code.

 

how can I do that ?

 


Lucas
  • profile picture
  • Member

Posted 20 December 2013 - 17:32 PM

IN THE CONROLLER

$crud->callback_column('NOMBRES', array($this, '_callback_get_nombres'));
    public function _callback_get_nombres($value, $row) {
        $data = $this->principal_model->get_basica_usuario($row->id_cerebro_usuario);
        return strtoupper($data->cerebro_usuario_primer_nombre . ' ' . $data->cerebro_usuario_segundo_nombre);
    }