Tutorial :How can i use MYSQL database connection in iphone application useing cocos2d?



Question:

I am working on project and i need to connect MYSQL database. I am success to connect SQLite in my project ( using cocos2d).But i can not connect MYSQL database in my project. I any one do like this than help me for how to connect . Give me the necessary information.


Solution:1

You will not be able to connect to MySQL directly from the iPhone. You must use some intermediate layer such as a Web application with PHP.

So, you will have something like this:

  1. iPhone POSTING a request to the WebServer using HTTP
  2. Web Server connecting to the MySQL database
  3. Web Server returning data to the iPhone (XML, plain text)
  4. iPhone processing the data

You can use this technique to query and insert/update/delete data.


Solution:2

This site contains a libmysqlclient.a file compiled for the iphone (arm).

http://www.eval-art.com/2008/09/05/libmysqlclient-for-iphone-2/


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »