I would like to do the following synchronization between two database on the same server, same username/password.
Source database: z_rent_roll
Target database: users
1. When user exists in the source and targer database, but some of the user fields changed in the source database, I would like to reflect that by updating the target database.
2. When user exists in the source database but not in the target database, insert record to the target user table.
I know how to do this as a stored procedure in Oracle but not as a php code with MySQL.
here are the steps:
1. Check for source user data against target data for any updates- Select statement should return only those records that need to be updates
2. Take those returned records and update them in the target datase.
3. Check for source user data against target data for any new records
4. Insert new records into the target database.
This script will be run a as a cron every 10 minutes.