How do I send data from an SQLite database in an iPhone application to a web service?

I am creating an iphone application that will run a SQLite database. I want the application to check when starting the MySQL database on the web server to see if there are any new entries. If the application will capture new entries.

So, I believe that I need to determine the latest record in the application, and then send it to the web service (php page), which will compare the id field from the most recent record in the application with the most recent identifier on the Internet db server. If they do not match, the web service will return the new entries so that the application can capture them and add them to the application database.

I will get the most recent record identifier using this query: SELECT id FROM MainTable ORDER BY id DESC LIMIT 1. But how can I send the result to a php page for comparison with a web database?

+4
source share
2 answers

Here are the steps: 1) you need a web server with MySQL and PHP, if you do not have a web service for the iPhone, then I would like to send you 2) Make a web service call using NSURL (make sure you call the web service ) you can use ASIHTTPRequest which is better than CFNetwork

Notes. Write a PHP script that should return JSON data that is easy to parse. Use https (safe method)

Let us know if you have a problem.

+1
source

To do this, I believe that you really should write code - I do not know about a โ€œcannedโ€ solution.

0
source

All Articles