IMHO the best way is to just have a php file on the server which handles the actual database side of things, this way you don't have to hardcode your authentication into your application so much, and just parse the parse the page results you get back.