Josh Sager Media: Creative Technologies Blog

Josh Sager Media: Creative Technologies Blog
Creative Technologies Blog
Home | Portfolio |Blog | Presentations | music | About

Adding Records to MySQl DB using ActionScript 3.0

An all too familiar question for my advancing students.  How can I use flash to communicate to a MySQL database.

There are a few options at our disposal

  1. Basic php and URLLoader Requests
  2. AMF Framework (zendAMF of AMFPHP)

Your needs will really answer the question for the method you’re choosing.  In this case we just need something quick and dirty so we will go the route of basic PHP and URL Requests.

Source files for adding records to MySQL db using ActionScript 3.0 (.zip)

In the package you’ll find the following

  • connectToDB (fla files version 1 - 3)
  • ConnectToDB.as (The class file)
  • flashDB.sql (your database)
  • getRecords.php (this will get your records)
  • newRecords.php (this will add new records)

The fla Files

These files will step you through basic connection, display of database information, and interaction with the database.

The php Files

These files will simply display and add records

The Class File

The class file has all of the magic needed to perform what you’re looking for.

How Does this Work?

It might sound like a cop out, but you really have to download the source files and experiment.  This may not solve your problems directly, but it should get you on the right track.  If I get time I’ll post a screen cast walking through the entire process.  For now though take a peek and let me know if you have any problems.

Tags: , , , ,

Leave a Reply