Normally you would use a webservice (via SOAP, REST, JSON, …) for such tasks, as this would prevent opening the database-server to the public and also makes you independent from the used programming language.
2
solved iPhone application Getting data from Mysql database