Re: Talk between Flash Builder and x10hosting
There is no particular "relationship" between PHP and MySQL. The perception that there may be one comes simply from the fact that both PHP and MySQL (at least in one of its license configs) are free, and that most hosting providers throw both into the basic package for free. That has made MySQL the default assumption for the database back-end for PHP applications as a matter of history -- it could as easily have been PostgresSQL or some other free database. (If the process were to start today, it's actually more likely that some document database like CouchDB or MongoDB would have been the default choice, since the majority of applications -- and by that, I mean individual instances, not distinct code bases -- are things like blogs and bulletin boards, which are far better suited to the NoSQL paradigm.)
In any case, you'd want to use PHP pages to intermediate between the MySQL database and your Flash app. Opening the database to global user access is just plain asking for trouble. From PHP, you can condition the queries and condition the responses. It's been a while since I last used Flash in any form, but I remember it having native methods for processing XML, and since ActionScript is a close cousing of JavaScript, it ought to be able to handle JSON as well. The PHP page can return either. To the database, the queries will be coming from localhost rather than from "the world", so you can close access down rather effectively, and there's only local communication latency to deal with -- not the kinds of delays you may experience over the internet. Plus, there's connection management -- when the PHP response is sent, the database connection is safely closed. With direct application access from Flash, there's no guarantee that your connection pool is going to be there when you want it, since users can leave connections open, and there will be (one hopes) times that more users are trying to fetch data than you have available connections for them to use.
tl;dr summary: code your Flash app to make requests to a PHP page, and let PHP handle the database queries and response formatting.
“Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
"It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)