I am creating an iphone app that will run an SQLite database. I want the app to check, at start up, a MySQL database on a web server to see if there are new records. If there are the app will grab the new records.
So I figure I have to identify the most recent record in the app then send that to a web service (php page) that will compare the id field from the most recent record in the app to the most recent id in the web server db. If they don’t match the web service will return the new records so the app can grab them and add them to the app database.
I’ll get the most recent record id using this query: SELECT id FROM MainTable ORDER BY id DESC LIMIT 1. But how do I then send the result to the php page to compare to the web database?
Here are the steps:
1) you need a web server with MySQL and PHP, if you do not have Web-Service for iPhone, then i would like to you refer
2) Make Web Service Call using NSURL (Make sure how you are calling the web-service). you can use ASIHTTPRequest which is quite better than CFNetwork
Notes : Write a PHP script that should returns JSON data which easy to parse.
Use https (secure method)
Let us know if you have any issue..