Sedang Disiapkan

Make a php-function to sync one master-db to clients-dbs

Urgent project.

I want a sync-function/script written in PHP against MySQL. Meaning I want to sync data-structure in one database to a number of other databases. Please read and understand the requirements closely. I'm in a hurry and very busy, so I can't afford to write it myself. It is not a difficult project, but you just need to awake and know php by heart.

Assume I have a list like below. First line is the source-db, the next ones is the target-dbs.





There are about 7 tables to care about in each.

All tables have a key-column like user_id, menu_id, field_id (ending with ID). And table is named "user", "menu","field".

So verry easy to use (and understand I hope!).

foreach db in list:

- Compare definition for 7 tables: field_names, field_length, field-type (integer, varchar 255 or text) and default value against masterdb1 only.

- If the table-columns in db1, db2, db3 and so on has a different order, field_name, lengt or type: you must adjust them.

- In addition: The | in list above, lets say db1, is saying that you should also query table "user" for field user_id where values are between 1 and 3.

- The values returned from each of the queries above shall update and/or create all the user_id values between 1 and 3 for instance in that db.

- If no table exist, it shall be created and look 100% like masterdb1, but only with the first few rows (like 1 to 3).

Quick and dirty (simplified):

Forach db:

compare field-definition and alter/drop/modify each of db1, db2, db3 etc.

extract a few rows (select * from sometable in masterdb1 into sametable in db1)


I want function-oriented (not object-oriented) and easy-to-read code.

No framework or helper-class.

A-dry run shall be possible (show all the changes and sql-that will be peformed).

I need it by monday.

Table-names: user,menu,lang,string,field,group,page

Key-fields: user_id, menu_id, lang_id, string_id, field_id, group_id, page_id

Kemahiran: MySQL, PHP

Lihat lagi: type of data structure in c, string in data structure, string data structure, php, mysql, one key data, number function, named query, meaning of data structure, key data structure, i want to write about myself, i need to write about myself, helper table, function number, foreach in php and mysql, extract number from string, different type of data structure, definition of data structure in c, data structure type, data structure meaning

Tentang Majikan:
( 84 ulasan ) OSLO, Norway

ID Projek: #9910837