updating only some records of some tables of a database

From: Date: Mon, 20 Jun 2005 22:36:46 +0000
Subject: updating only some records of some tables of a database
Groups: php.general 
Request: Send a blank email to php-general+get-217271@lists.php.net to get a copy of this message
Hi I manage a couple of mysql databases that are hosted on my server as well as at my ISP. We do update quite often some records in different tables & databases. As in South Africa, we pay per GB of traffic, complete dumping of all databases every day is excluded. I am looking at a better way of only synchronizing the records that have been modified. In every table I created, I have a date_created & a date_modified, and of course everytime there is an automatic or manual update of the data, date_modified is updated. In phpMyAdmin, I can easily select all the rows updated since the last sync date and export these rows in an sql dump file. However I haven't found the way to use a select query before an export on these rows only in a php script outside phpmyadmin. If I could get a simple command like select * from table x where date_modified > date_sync dump the results into file z.sql Is that simple and easy or do I have to write a script that read the structure of any table and compose a string such as REPLACE INTO table a (field1, field2, ...) VALUES (1, 'abc', ...); for each row modified? The final idea is to make a loop on all databases, then on all tables inside each database and run that script to export into a big file. Is there any limit of reading the dump file via php system? system("mysql -uUSERNAME -pPASSWORD DATABASENAME < DUMPFILE"); I would really appreciate advice on this matter... -- Kind regards, Paul. Gondwana Info@gondwanastudio.com http://www.gondwanastudio.com

« previous php.general (#217271) next »