views:

199

answers:

2

Hi,

I am making an offline website that needs to sync every night with a server. Our employees work outside and sometimes underground and need to access the site for its database. But once home they must send us their findings.

The first time they connect, I check with google gears if they have the sqlite database and if not I run a script to insert it. Once they have it, I sync their next appointments to their local database.

When they are done, the next day, they connect to send us every thing and to download their new appointments.

For now i was able to create the sqllite database and insert new values inside thanks to google gears. But i haven t found a way to read the database with php to sync it with our online database.

To go from online to off, with PHP I can write an array in a hidden field and then read that field with JavaScript. But in the other way i was wondering if there was on other way then creating a form with DOM and submitting it in JavaScript to read the values with PHP?

I need to sync a Lot of values, do you know if there is an easier way?

Thanks for your help

+1  A: 

You should use Ajax for posting your new data to the PHP server.

You could use jquery (or any other framework), their lootle of resources how to post data to php on the web.

Your webpage could have a button hidden when offline, this button would enable user to start a synchronization.

Here a tutorial from PHP and jquery!

RageZ
thank you for your quick responseI knew about the hidden sync button, style.display = try to ping the server if success ? block : none.can you tell me a little more about the functions i could use in jquery?
Le Filou
+1  A: 

I have found vortex, a powerfull script for gear that helps sync everything from files to data. It will definitely help me.

Here is the link to the developer's blog. The download link is in there.

I will come back when the website works to help the interested.

Le Filou
actually that doesn't help at all. Well the search continues!!!
Le Filou