⚠ 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

Problem: How to set_relation_n_n when "Relation Table" only has 2 fields



tugtank
  • profile picture
  • Member

Posted 01 November 2013 - 16:28 PM

Hello all,

 

I need help creating the output of this many to many relationship.  The example on the site refers to a "$priority_field_relation" field, I'm not sure what to put there because my relation table only has 2 fields, where the example has 3 the third being the priority field relation.  Here is my code, the db tables are below it:

 

$crud = new grocery_CRUD();
$crud->set_table('references');
$crud->set_relation_n_n('authors', 'x_references_authors', 'authors', 'auth_id', 'ref_id', 'Not sure what to put here');
$crud->fields('title','ref_date');
$output = $crud->render();
$this->_example_output($output);

 

here are the database tables:

x_references_authors (Relation Table):

auth_id

ref_id

 

authors (Selection table):

auth_id

first_name

last_name

 

references :

ref_id

title

ref_date

publication

 

Thank you!