J
|
Jane 2/8/2008 |
Hi, |
M
|
mrphp author 2/8/2008 |
Hi, you need to add new business_id field (integer, not auto-increment) to the contact table. Use this field as foreign key in the master-detail relationships on the Datasource tables tab. Then when you add new record to the contact table go to the bussiness table first, proceed to the detail table (using detail link) and add new record. In this case business_id field will fill automatically. Also I recommend you to have a look at the following article: http://www.xlinesoft.com/phprunner/docs/ma...elationship.htm
|
H
|
HMIS 2/9/2008 |
OK. I added business_id to the contact table. Now I can select a contact and that works. However, when I search contacts I don't have a link back to the company.As an example, I search for Smith on the contacts page and 5 records are shown. I'm unable to determine what company they each are associated with. I don't seem to have an option to create the same link from contact to company. If I select the business table as the detail, the business_id field is not available. Am I missing something? Thanks for your help.
|
M
|
mrphp author 2/11/2008 |
I just did what you're looking to do Create a custom view then edit then edit the SQL query using this format SELECT survey.Legal_Problems, survey.Valid_License, survey.Hospital_Stays, survey.Given_Up_Work, survey.Same_Employer, survey.Have_Auto, clients.First_Name, clients.Last_Name FROM clients INNER JOIN survey ON (clients.business_id = survey.business_id)
|
H
|
HMIS 2/13/2008 |
I'm getting incorrect syntax messages. Are your 2 tables "survey" and "client"? I assume you are not using MySQL. Thanks for your help.
|
M
|
mrphp author 2/14/2008 |
I am using MySQL with PHP ..if you submit the tables and fields Ill write the sql that works ... also you need to follow what jane wrote ...its quite simple really. Hopefully your using phpmyadmin to manage your MySQL database
|
H
|
HMIS 2/18/2008 |
Here are my tables and fields: Table: business Fields: business_id contacts_id company street city state zip cophone fax type trade comment date Table: contacts_name Fields: contact_id business_id contact position extension cell pager comment My "main" list is based on the business table. Clicking on "contact" then takes me to the Contacts_name table list with the list limited to contacts that work for that particular business. Where I'm struggling is with the link to go back to the business that relates to these contacts. In particullar, if I search the contacts_name list for a person's name I have no way to know what company he works for. And yes, I do use phpmyadmin. Thanks for taking the time to help me with this. Thanks to everyone who takes the time to help in this forum.
|