Hey i am developing an iPhone app of a existing PhP mySQL website. i want to know, how to pull data from database开发者_C百科 and display on the phone? after going through several articles , i found out two ways..
1) create a web service, on server end, which will provide all the data in XML format to the device.
2) export php,mysql data in JSON format, and pass this JSON data to the device, which will parse it..
are these two correct approaches?? if yes, which is easier and faster?
If you want to create a webservice from PHP to iPhone I suggest you to use JSON.
You can create a JSON response using json_encode (see manual here) and easily decode it on the device using SBJSon (you can download it here)
精彩评论