You are here: updating only some records of some tables of a database « PHP « IT news, forums, messages
updating only some records of some tables of a database

Posted by Paul Godard on 06/21/05 01:36

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация