⚠ 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

how to fetch data in db from one table and set as a value of a data field in add form



hurtz

hurtz
  • profile picture
  • Member

Posted 19 January 2017 - 05:54 AM

I have two (2) tables, tble_users and tbl_registry. how can I fetch the value of tbl_users.divID of a specific record and set that as the automatic value of tbl_registry.divID when I add a record. Im still on the process of learning CI so I hope someone can help me. Thanks.

 

In relation to this, pls refer on the attached print screens. If I click on the link Action Officer on the first pict, the second pict will appear (I've done this already). My problem now is how can I capture the value of Task ID on the first pict and make it as the automatic value of Task ID when I add a record on the second pict.


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 24 January 2017 - 06:34 AM

Well my friend - you can use callback after insert (if u want to set the value post insert)

OR 

You can do it with callback before insert - where in the array of values that the GC will use - u can set the value from the 1st table into respective field.

 

Either way - you surely should be able to achieve it.

 

Happy GCing :)


hurtz

hurtz
  • profile picture
  • Member

Posted 24 January 2017 - 07:11 AM

thanks Amit. I'll try that one and hope it will work :)