Gears and Mysql sync - php

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

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.

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!

Related

html5 local storage, database connectivity

I'm designing a website using html5,css and JavaScript mainly for client-side validation. Also I'm designing an app which will request the data entered in the website from a database. i.e if user searches for a contact, it should display the info entered in the form from the website. i don't know which route to take in terms of d/base connectivity. I'm new to html5 storage(local Storage) and php for server-side scripting. I understand that local storage is browser dependent and data is stored in the users browser.Also if you want to have registered users(premium members) is it better to have database in the server connected via php scripts or localStorage works pretty much the same?
I can't answer everything but since you asked I can answer a few.
Q: User registration while also using a membership service PHP or localstorage?
A: PHP connected trough a Database never use localstorage for this.
Q: Search trough a site, LocalDB or Database?
A: Database.
Pretty much everything you mention there should use a database.

IOS app to upload data to database using php

Im creating an app where the user inputs match events in a rugby game and the player who done it. e.g. pass,wing or try,scrumhalf. This information needs to be uploaded to an external database for the website to have access to it.
I don't want every time the user clicks an event for it to upload it to the database. I want them to do a whole match with it somehow storing it on the ipad. The user then clicks an upload button and all the events get uploaded to php which then inserts them into the database.
How is the best way to go about this?
I've tried everything and not sure.
Suggestions and example code would really be appreciated.
Thanks
Sounds like your app should /may do a 'simple' call to a REST-API.
You should find a lot of examples for that. For networking you should find a more comfortable lib at cocoapods.

notify user in android application when inserting new record by website

I have an android project that connected with website using php and MySql DB
I want to notify the user that has the application when the admin insert new record by the website.
I'm searching for solutions, and I found this one
http://developer.android.com/guide/google/gcm/gs.html
but I didn't Know, is it the suitable solution for me?
or there are another solutions
thanks
That looks like a fine way to notify your app - you'll just have to add in the code on the website to call gcm when the data changes.
Another solution would be to have your app periodically poll the website for changes, but that's costly in terms of bandwidth. I'd use GCM

Using Google Plus API to store stream data in MYSQL database

I've been playing with the Google+ API PHP starterkit. My ultimate goal is to run a cron job on my server that uses the Google+ API to grab the activity data, then store it in a MYSQL database-- where I can then dynamically update a twitter-like feed on a website.
Is this a possible/practical way of mining a Google+ profile's public stream? If not, what do you suggest as a good alternative?
Sounds like a good way to me.
One thing you have to keep in mind though is that there is no easy way to check if an activity has been deleted after you have added it to your database. You would have to check with $plus->activities->get($activityId) for each of the activities you want to display to see if it still exists (unless of course you don't mind them appearing on your website).
Apart from that your solution will work fine.

php chat client

i need to create a chat application in php+js+ajax which need to be integrated to a site, where am stuck is to create a chat window , that need to be constant while going through different pages in the site . if any one can suggest a better way i will be grateful, thanks in advance
As for the actual chat application...
Using some kind of technology to push data from the server -> your users is the best way to achieve a real-time chat application.
I would highly recommend checking out APE (Ajax Push Engine).
It takes care of the server-side stuff and allows you to seamlessly transfer data from the server -> client.
As far as the chat window staying when you change pages, I can think of three options:
Put the chat in a separate frame and only change the main frame when going to a new page.
Change the page content with AJAX instead of making a full page reload.
Assuming the chat messages are being stored on the server, simply repopulate the chat with the most recent messages after the new page loads.
There are plenty of tutorials available, try one of these three that came up first from a Google search for "php chat tutorial":
http://www.tutorialized.com/tutorials/PHP/Chat-Systems/1
http://code.jenseng.com/jenChat/
http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=9

Categories