Jump to content


IDe

Member Since 15 Apr 2015
Offline Last Active Jun 22 2015 01:12 AM
-----

Topics I've Started

callback after insert

03 June 2015 - 04:41 PM

hello ...

I have this problem ,,, I want to insert in 'traza' after insert in clasificacion... with the purpose of do a trace system of users ...

I have this ...

  if ($this->ion_auth->logged_in() && $this->ion_auth->in_group('admin')) {

            try {

                /* Creamos el objeto */
                $crud = new grocery_CRUD();

                /* Seleccionamos el tema */
                $crud->set_theme('flexigrid');

                /* Seleccionmos el nombre de la tabla de nuestra base de datos */
                $crud->set_table('clasificacion');

                /* Le asignamos un nombre */
                $crud->set_subject('clasificación');

                /* Asignamos el idioma español */
                $crud->set_language('spanish');


                /* Aqui le decimos a grocery que estos campos son obligatorios */
                $crud->required_fields(
                        'id_clasificacion', 'clasificacion'
                );

                /* Aqui le indicamos que campos deseamos mostrar */
                $crud->columns(
                        'clasificacion'
                );

                $crud->callback_after_insert(array($this, 'trazar_after_insert'));
                $usuario = $this->session->userdata('user_id');
                $fecha = mdate();
                
                function trazar_after_insert($post_array, $primary_key) {
                    $traza_insert = array(
                        "id" => $primary_key,
                        "id_usuario" => $usuario,
                        "accion" => "insertó",
                        "fecha" => $fecha
                    );

                    $this->db->insert('traza', $traza_insert);

                    return true;
                }
traza's table have this ...
TABLE `traza` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_usuario` varchar(128) NOT NULL,
  `accion` varchar(128) NOT NULL,
  `fecha` date NOT NULL,
  PRIMARY KEY (`id`),
  KEY `slug` (`id`)


after the insert in clasificacion I can't see nothing in traza's table ... why ??  ,,, please help
 

 

 

 


insert into two tables + load templates

16 April 2015 - 02:06 AM

Hi ,,, I'm a beginer using CI ,,, I have a few questions

- How I can insert into 2 tables from the same Form?

- How I can make GC output  work with templates?

 


insert into two tables + load templates

15 April 2015 - 09:41 PM

I am new to the theme of the use of SI,,,,,, I have several problems if to insert into two tables from the same form as it could be? ,,, Other problem is,,, load templates help meeee