Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Synchronising a MySQL DB with PHP

Status
Not open for further replies.

MrBelfry

IS-IT--Management
Joined
May 21, 2003
Messages
289
Hi there

I work for a church and am creating a php application for managing a database of all the sermons preached. I have the first attempt of this almost running on the local network at work. One of the options my app gives is posting details of the sermon onto the website (lighthousecc.co.uk) so I would need to do some kind of synchronisation with the mysql server on my web host.

I'm trying to work out the best approach. Is it:
a) delete the data in the mysql db on the host and repopulate it with data from my local db
b} keep a list of updates on my local db then make the changes to the data that already exists on the remote db.

Which would be the fastest, lesat errorprone way of doing this? any suggestions would be extremely helpful

MrBelfry
 
MrBelfry,

if you're searching for the fastest, error-free method, i strongly suggest bethob b} . the record would only be updated if it needs, without deleting and re.inserting it.
imagine you were using method a} and the server had some sort of crash during the deletion/re.insertion proccess :p i don't know the size of your db, but if it's big it would waste u a lot of time..

so, overall, i would suggest method b} something like
Code:
* if (remote_db_line[$i] != local_db_line[$i]) { update it; $i++; } else { $i++; } *
hope it helps :]

jamesp0tter.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top