⚠ 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

Set relation between 3 tables



kwstasna

kwstasna
  • profile picture
  • Member

Posted 31 January 2016 - 11:26 AM

I have 3 sql tables and they are with this form.
 
TEST


 - test_id 
 - test_name


EXAMPLE


 - example_id
 - example_test_id




SOMETHING


 - something_id
 - something_example_id
 
So i want to take the name of the TEST table among with the id 
and send it to the table EXAMPLE, and then the example_id should be sent to SOMETHING table.
Finishing the relation i want the name of the TEST table to be shown by the example_id in the SOMETHING table.
 
We have tried this 
 
     $crud->set_relation_n_n('something','example','test','example_id','example_test_id','test_name');
 
And it takes the id of the TEST and it saves it to example_test_id but we want it to be saved at something_example_id and show the test_name.
 
Hope you understand.

 


moe2801

moe2801
  • profile picture
  • Member

Posted 03 February 2016 - 16:12 PM

Do you have foreign keys and primary keys in your tables? 


kwstasna

kwstasna
  • profile picture
  • Member

Posted 03 February 2016 - 18:17 PM

Yes there are foreign keys and primary keys.