updating only some records of some tables of a database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx
http://www.gondwanastudio.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux