⚠ 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

Procedure



gersontk
  • profile picture
  • Member

Posted 03 September 2013 - 03:49 AM

hi all.
i need a help.
how to pass parameter for storage procedure?
i need pass id(pk) and another id(pk). look the code.
how can I dynamically pass ids??

 

 

public function socio(){
            $this->load->dbutil();
            $crud = new grocery_CRUD();
            $crud->set_theme('datatables');
            $crud->set_table('socio');
            $this->dbutil->optimize_database();
            $crud->set_subject('Cadastro Socio');
            $crud->display_as('area_id_area','Departamento');
            $crud->set_relation('area_id_area','area','nome_area');
            $crud->set_relation('estado','estados','estado');
            $crud->set_relation('cidade','cidades','cidade');
            $crud->set_relation('situacao','situacao','tipo');            
            $crud->add_action('Dados','','template/dados','ui-icon-gear');
            $crud->callback_add_field('nome',array($this,'callback_to_cap'));
            $crud->set_field_upload('foto','assets/uploads/files');
            $crud->callback_after_upload(array($this,'callback_image_size'));
            $crud->required_fields('nome','sobrenome','cep','cpf','rg','fone','cel','end','bairro','estado','cidade');            
            $output = $crud->render();
            $state = $crud->getState();
            
 
            if($state == 'success'){
                /* passar id do socio e id da area */
 
 
               here pass id socio and id area
                $sql = "CALL gerarParcela(0000000021, 1)";
                $this->db->query($sql);  
                redirect('template/socio');
               //$this->db->call_function('gerarParcela');
               //$this->db->conn_id;
            }
            
            
            $this->_example_output($output);                           
        }

 


gersontk
  • profile picture
  • Member

Posted 03 September 2013 - 23:02 PM

no helps?


davidoster
  • profile picture
  • Member

Posted 04 September 2013 - 03:45 AM

You need to use the callbacks for this, For example use the callback_after_update where the callback fucntion gives you the actual post array along with the primary key of the record.

Then you just move your CALL SQL code to this callback function.


gersontk
  • profile picture
  • Member

Posted 04 September 2013 - 04:13 AM

thanks for the help.
already trying to implement that way, but it did not work. I think I did something wrong, I'll try again. ;)