Talk between Flash Builder and x10hosting

shigekims12

New Member
Messages
8
Reaction score
2
Points
0
It seems I have stumbled upon an excellent and collaborative community here at x10hosting!

Consider me computer literate in your response, here is my request:

I am using Flash Builder CS5 on my computer, and I want to start learning flash development by building an application with it.

Working through the tutorials, I’ve come across the “Server technology” setting (includes PHP, ASP.NET, ColdFusion, and J2EE). I don’t understand the relationship between MySQL databases and PHP, but I understand one exists.

In the settings for the Flex Server for PHP Application server type, it requests:

Server location
Web root: ?
Root URL: ?
(Example http://localhost)

Is there a way I can use the MySQL hosting of x10hosting to associate my Flash Builder project with a database I create on x10hosting?

Any help would be appreciated, especially from those with background in Flash Builder, or those experiences in flash development of applications that use/write data on a server.

Thanks a lot!
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
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.
 

shigekims12

New Member
Messages
8
Reaction score
2
Points
0
That definitely helped my understanding of PHP code, and MySQL databases. I can hopefully figure out the PHP scripting on my own with tutorials and examples. That part is intuitive, but does anyone have suggestions/links for where to start with that?

Additionally, is there anything specific I need to know about (accessing) the x10hosting MySQL database before I dive in?

Better even yet, does anyone have any skeleton code I could look at for a starting point of a functional PHP page that can intermediate between a flash app and MySQL?

Sorry for all the requests. I'm highly motivated and dead serious about learning this, but I'm having trouble getting over the energy activation barrier. Thanks for all your help.
 
Top