PDA

View Full Version : Flash - PHP/MySQL : Where do i start?


Kenzo
12-09-2005, 06:44 PM
Hey, i'm doing my first flash web site where the client has asked
that all the data / images is store externally from the flash file.
so obviously it will be a flash site connected to a MySQL server
via PHP.

where do i start? is there any books i will need to check up
on first? / anything i need to bear in mind? / any extra
programms i may need to get? (i've got studio MX at the moment)

thanks x

Paerez
12-09-2005, 07:34 PM
For PHP through Flash with MySQL, you want to look up AMFPHP for the Flash-PHP stuff, and Flash Remoting.

In flash remoting, you want to use the Service class, and the Responder class. Most tutorials will show you how to set up the gateway.php, and then you have to set up your own php classes for doing whatever it is you want to do.

I hope at some point to put together a nice Flash 8, PHP > 4, MySQL > 4 guide, but it may be a while (stupid exams...).

If you need more help on this, here is a nice thread:
http://www.actionscript.org/forums/showthread.php3?t=89720

I have some posts there with a lot of my source code.

Flash Gordon
12-09-2005, 07:37 PM
i learn by simply looking through the server side section here.

CamX
12-13-2005, 09:14 PM
Go to http://www.flash-db.com:)

mgomez03
12-14-2005, 06:36 AM
David Powers from Friends of ED wrote one of the few Flash-centric PHP/MySQL books out there.

http://www.friendsofed.com/books/1590594665/index.html

If you're looking for books on the subject, this is the one to get (IMHO of course).

Gibberish
12-15-2005, 05:21 PM
I use www.sitepoint.com/forums for serverside scripting questions. Also you and www.php.net and www.mysql.com should beocme good friends.

What I tend to do is store the data in mysql but have flash call an xml document that is created by PHP from the data in the mysql database. You can either create this data on the fly each time it needs to be cached or you can run a daily job so the php updates the xml at say 11pm every night. I would recommend the latter.

Here is some reading:
http://builder.com.com/5100-6388-5035149.html#Listing%20A
http://webservices.xml.com/pub/a/ws/2004/03/24/phpws.html

here is some PHP script I also found through a simple google search. This should create an exact copy of the databse called but formatted for XML.
<?php
$connection = mysql_connect("localhost","user","paswd") or die("Could not connect");
$db = mysql_select_db("database-name") or die("Could not select db");

echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n\n";
echo "<database>\n";

// insert you table names in this array:
foreach (array("table1","table2","table3","table4") as $table)
{
$result = mysql_query("SELECT * FROM $table");

echo "\t<$table>\n";

while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "\t\t<row>\n";

foreach ($row as $field=>$value)
{
echo "\t\t\t<$field>$value</$field>\n";
}

echo "\t\t</row>\n";
}

echo "\t</$table>\n";
}

echo "</database>";
?>

ssjskipp
12-17-2005, 12:02 AM
Well, there's a tutorial I wrote on this!
http://www.graphicaddicts.net/forums/index.php/topic,1122.0.html