⚠ 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_n_n not saving to db



threestatedrive

threestatedrive
  • profile picture
  • Member

Posted 11 January 2013 - 18:41 PM

i have done this successfully in another instance, but for some reason, this isnt saving to the db

i have a table Cases
case_id
case_title

a table Posts
post_id
post_title

and my relational table is case_post
case_id
post_id
priority

In my Case controller, i want to be able to relate multiple posts, so my controller code line is:
$this->grocery_crud->set_relation_n_n('posts', 'case_post', 'posts', 'case_id', 'post_id', 'post_title','priority');


it displays no problem in my edit page, but when i try and save, it doesnt...
i'm really struggling to see why
on my post controller, i am able to do it with a post_cat relational table, and even in the Case controller, if i utilize the post_cat code, it saves.. just not this table.. I've even tried rebuilding the table, but to no avail..
anyone seen this before?

goFrendiAsgard

goFrendiAsgard
  • profile picture
  • Member

Posted 20 January 2013 - 15:52 PM

Have you check the field types of each table's fields?

threestatedrive

threestatedrive
  • profile picture
  • Member

Posted 21 January 2013 - 13:10 PM

i got it sorted thanks!
ugh. i had overlooked that i didnt have the field included

tim8917

tim8917
  • profile picture
  • Member

Posted 11 February 2014 - 15:23 PM

i got it sorted thanks!
ugh. i had overlooked that i didnt have the field included

Could you explain what helped you? I've the same problem: in one case set_relation_n_n works fine, in another case with similar conditions it fails.


voghDev

voghDev
  • profile picture
  • Member

Posted 30 March 2015 - 13:20 PM

I'm having exactly the same issue; Saved when editing, but not when adding rows.

 

Similar topics:

 

/topic/2821-little-question-about-a-n-n-relation/

 

/topic/1665-set-relation-n-n-no-save-en-bd/

 

Could you please give details about how you solved it? Seems like plenty developers are having the same issue. 

 

Thanks in advance.