⚠ 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 function in set_relation_n_n not work



Alfandi Nurulmukhlis
  • profile picture
  • Member

Posted 01 October 2013 - 11:35 AM

please help me again..

sorry for my bad english..

i have code in table "user", i give function set_relation_n_n but add function not work properly, but when i edit , it works properly

i have table relation :

grocery user table.PNG

i add record:
grocery when insert user.PNG

but it not saved in field relation_n_n:
grocery user add.PNG

 

in table "room_access" not saved:

grocery acces room.PNG

when i edit table "user", it work properly:
insert well.PNG

table "acces_room" view:
access room insert well.PNG

this is my code:

public function user()
    {
        $this->grocery_crud->set_table('user');
        $this->grocery_crud->set_subject('User');
        $this->grocery_crud->required_fields('Rfid','Id_User','Nama_User','Id_Status','Room_Access');
        
        $this->grocery_crud->display_as('Id_Status','Status');
        $this->grocery_crud->set_relation('Id_Status','status','Nama_Status');
        $this->grocery_crud->set_relation_n_n('Room_Access','room_access','ruang','Rfid','Ip','Nama_Ruang');
        
        $output = $this->grocery_crud->render();
        $this->crud_output($output);
    }

 


help me.., thanks in adv..


Alfandi Nurulmukhlis
  • profile picture
  • Member

Posted 02 October 2013 - 04:22 AM

My analysis :

in main table "user", primary key must integer and AutoIncrement, that's work properly

if primarykey in main table Varchar, that's doesn't work . . .