⚠ 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

Dropdown issue



joeinatlanta

joeinatlanta
  • profile picture
  • Member

Posted 13 June 2016 - 23:56 PM

I have searched this forum for a simple answer and have had no luck.  I know you can build table relationships.  In my case, I have the following:

 

Table Company : Fields companyId and  companyName

Table Salesperson:  Fields companyRef and spName

 

I set relation:  $crud->set_relation('companyRef','Company','companyID')

 

First, how can I view the companyName.  And second, when I attempt to edit, I want to have a companyName dropdown but update the companyId field when done.

 

Please, don't send me to view set_relation topic.  I have read it and it does not apply to my needs.  

 

Joe

 

 


joeinatlanta

joeinatlanta
  • profile picture
  • Member

Posted 14 June 2016 - 00:17 AM

Sooo, I found the answer to my own question.  I guess my only question would be, when you set the relation you specify your foreign key and your parent table.  How does it know which field to use as the primary key?  Joe