Jump to content


set_relation_n_n no save en BD

set_relation_n_n bd save

  • Please log in to reply
3 replies to this topic

#1 KWD

KWD

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 10 May 2013 - 06:02 AM

hello I'm new to this but I have a problem follow the examples and several forum post but not that set_relation_n_n not guerdan in the database I hope someone help me I will put the code below

 

 

These are the tables

componentes

num_int_com primary key auto_increment
num_ext
num_parte
descripcion

 

productos

 

num_int_pro primary key auto_increment
num_ext
descripcion

 

 

rel_com_pro
prority primary key auto_increment
num_int_com foreig key
num_int_pro  foreig key

 function productos()
  {
    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('productos');
    /* Le asignamos un nombre */
    $crud->set_subject('Productos');
    /* Asignamos el idioma espaƱol */
    $crud->set_language('spanish');
    /* Aqui le decimos a grocery que estos campos son obligatorios */
    $crud->required_fields(
      'num_int_pro',
      'num_ext',
      'num_parte',
      'descripcion',
      'precio_compra',
      'precio_venta',
      'stock',
      'ubicacion_bodega'
    );
    /* Aqui le indicamos que campos deseamos mostrar */
    $crud->columns(
      'num_int_pro',
      'num_ext',
      'num_parte',
      'descripcion',
      'precio_compra',
      'precio_venta',
      'stock',
      'ubicacion_bodega',
      'imagen'
    );
    //////////////////////////////////////////
    $crud->set_relation_n_n('componentes que necesita el producto', 'rel_com_pro', 'componentes', 'num_int_pro', 'num_int_com', 'descripcion','priority');
    //////////////////////////////////////////
    /* Generamos la tabla */
    $output = $crud->render();
    /* La cargamos en la vista situada en
    /applications/views/componentes/administracion.php */

    
    $this->load->view('vista', $output);
    }catch(Exception $e){
      /* Si algo sale mal cachamos el error y lo mostramos */
      show_error($e->getMessage().' --- '.$e->getTraceAsString());
    }
  } 
 

 



#2 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 10 May 2013 - 09:38 AM

Your set_relation_n_n seems fine I think.

Try to comment out ( // ) the required_fields to see what happens.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#3 KWD

KWD

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 10 May 2013 - 06:35 PM

thanks for all the help



#4 voghDev

voghDev

    Member

  • Members
  • PipPip
  • 20 posts

Posted 30 March 2015 - 10:46 AM

See this thread:

 

http://www.grocerycr...a-n-n-relation/

 

And post comment if you find a solution!







Also tagged with one or more of these keywords: set_relation_n_n, bd, save

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users