0

I have created a HTML5 webapp that runs quite nicely on most smartphones. Program can accept input from a user, store the information, display it, edit it, delete etc. Works fine.

I was wondering if there is yet a standard way fo sychronising this information with a remote MYSQL server, heck at this point I would settle for being able to post the information directly to a remote server, completely skipping localstorage.

I have looked at the websqlsync on github, but having limited success getting it working.

Any guides, working examples, tutorials or general pointers or best practice at getting html5 localstorage onto a MYSQL server greatly appreciated.

MOLEDesign
  • 488
  • 8
  • 20

1 Answers1

2

Why don't you save the localStorage object as a JSON string, and pass that to the remote server? What do you want to do with the data on the server?

Hidde
  • 11,493
  • 8
  • 43
  • 68
  • agreed, I think you (OP) are overthinking what's required. You'll build a web service on your server that will take the JSON as input, decode it to array/object, and then update/insert your DB. – Robot Woods Aug 30 '12 at 13:55
  • It really matters what you need stored in your server, because I don't think you need ALL the `localStorage` data. Just make sure you double-check for security errors when you use localStorage, it can be edited locally. – Hidde Aug 30 '12 at 13:57
  • Thanks for the speedy responses. This is an internal app that takes information from users on a smartphone. Users basically record health/safety issues. My reason for localstorage is so app will still work if phone is out of coverage,it syncs the info when back in range. If initially the app needs to talk to a server to work, it is a good starting point, I was just thinking ahead from the early stages. So a webapp that gets the data, and sends to a webservice that actually does the processing then? I shall have a rethink, and try to find apprpriate examples to get me going. Thanks – MOLEDesign Aug 30 '12 at 14:06
  • Hiddle, sorry, ignoreed your question.. three simple strings of information, needs posting to remote MYSQL server. Already written the backend system to use the mysql database (a joomla component).. just need to get the data from the phones to the database using any means necessary – MOLEDesign Aug 30 '12 at 14:18
  • You can post the data to a PHP script with AJAX. Then, just use the PHP to put the data in a DB. – Hidde Aug 31 '12 at 20:54
  • In my apps instance, I found, for now, I can post direct to the database which I have done with JQuery and a server side script to do stuff with the POST data. – MOLEDesign Sep 25 '12 at 18:32