jeudi 26 mars 2015

Use ID from another mysql database?


I have a mysql database for form submission (written in PHP) data and a mysql database for CRM (using X2CRM) on the same server.


When a form is submitted on my website the POSTed data of the form will be sent to emails as notifications to customers signed up a contract. These emails are of customers stored in the crm database.


I would like to reference customer IDs as a FK with the form submission id on a table in the form submission database.


Is it better to directly access the CRM database with SQL and get insert the customer id accordingly on the form submission table DB as explained here http://ift.tt/1EZV6XG


I would query and use only the customer IDs that have contract status set to active.


Or should I maintain a table in the form submission DB with the required information of the customers (such as name, address email, contract status)? That would obviously mean overhead to maintain the data with the one in CRM?


So best to go with first option? But is it ok to use PK IDs from one DB as FKs in a table on another DB?


I guess with first option I will need to query the CRM database and use the relevant values (ID and email address) for each customer record everytim a form is submitted? What should be the efficient and recommended way to do this?





Aucun commentaire:

Enregistrer un commentaire