I am developing this iPhone application for a friend and I have to get a lot of data from a MySQL database.
I will be using PHP to get data from the database and then echoing out the data in an organized manner (as XML) and then the iPhone will parse the data into an array through NSXMLParser.
I still haven’t tried this yet but just wanted to know how efficient this way is. Will it be sort of slow to do that way and is there any other better way to do it?
Thanks
If you’re focused on efficiency, you want to push work to the fastest/cheapest link in the chain.
The less work the client has to do (which is usually very slow compared to servers) the better.
The less work your database has to do (which is usually very expensive) the better.
So, processing as much as possible in the php layer is the way to go.
Also, constructing your queries so that they are efficient and return the minimal amount of data is also good.
Unless the iPhone actually needs the xml data, don’t give it to the iPhone, it will take a long time to download and then more time to parse.