A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11336 Flash Movies | 2 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Surjit Dhami
» Title: Book
» Description: Book
» More by Surjit Dhami


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 5848 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: All-American Rejects
» Description: Get to know this great band by exploring their "practice room".


Random Links | Add your own Flash Related Links
Flash Tutorials 1277 Tutorials 7 New Tutorials Added!
What's New | Top100

» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» HTML Photo Gallery Tutorial
» Create your first flash site – PART 1
» How to Make a Flash Photo Gallery
» Unknown Tag: Title10
Random Tutorial | Add Site

Webmaster (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Backend

Categories Installing Apache 2.0, PHP 4.2, MySQL 3.23, and PHPMyAdmin
Author: Jeffrey F. Hill | Website: http://www.flash-db.com |

 
Page 8
«prev 1 2 3 4 5 6 7 8 9 next»

Using PHPMyAdmin and a Simple Example of creating a Flash Database app

The following exercise's work through creating a table, using PHP to access that table and building a Flash Client For the User Interface.

First Create a New Database: In the Text field just beneath 'Create a new database' on the main page enter FlashTest.  Then click 'Create'.  You should get a message such as 'Database FlashTest has been created'.  

Note: Creating a database will create a Folder in the C:\mysql\data directory.  You can check to see if the folder 'FlashTest' is their - it will be.  A database is made up of individual Tables, you can have as many tables in a database as you want.  Each time you create a Table in your database it will create 3 new files in your C:\mysql\data\FlashTest\ folder.  You really don't need to know this info - but it might be interesting to know where your data is physically being stored - that's where.

Next where going to create a table. On the current screen find where it says "Create new table on database FlashTest" - then for the Name call it "news".  For the amount of Fields enter "4".

On the next screen you'll see something that looks like a table.  Fill it out as following by selecting items from the drop down menu, or typing them into the fields - only the columns that where using where included:

Field Type Value Extra (other)
ID INT   auto_increment Check primary key
UserName Varchar 30    
News Text      
TimeAdd Date      

That's all you'll need for our first table.  After you've entered that click 'Save'.  After that you should come to a new screen and the message "table News has been created" should be up top.  You've just created your first table with PHPMyAdmin!

Other items you can now do with your database:  First of all try to explore all of the options in PHPMyAdmin.  You can't really hurt anything at this point so just try everything.  When your looking at a new table you can click on 'Properties' which allows to change some of the Fields and Type's around.  You can also click on Insert - where you can manually enter new records if needed.  One Important part is a bit further down that page where it says something like "View dump (schema) of database" - using the options below that you can create a backup of your database.  If you dump the Structure of the database this will create some SQL (instructions) in formatted text - this SQL can be used to replicate/backup your database on any computer by instructing MySQL how to re-create your database exactly as it was at the old location.  For this example is we dumped the table structure of 'FlashTest it would look something like:
CREATE TABLE news (
 ID int(11) NOT NULL auto_increment,
 UserName varchar(30) NOT NULL default '',
 News text NOT NULL,
 TimeAdd date NOT NULL default '0000-00-00',
 PRIMARY KEY  (ID)
)

Now what can we do with this table.  Well first where going to write two scripts and a small flash movie so that we can work with this table we just created.  The two scripts consist of your 'Middle Layer' that act as a messenger between your flash client and the MySQL database you have just created.

Building the Flash Client:  (All example files come with the download).  Since this tutorial has already taken a while - the Actual Flash client was included in the download and will not be covered here in great detail.  The main parts to it consist of 1 text area called: News.  Where you News will be loaded to from the database.  And two other text fields called 'UserName' and 'EnterNews'. Their is also one button.  What this will do is just a small example of selecting and inserting data from/into a MySQL database.  On the 'Add News' button their is the following Actionscript: loadVariablesNum("AddNews.php","0","POST");  This handles adding/inserting a new record into the database.  Their is also one frame action that loads the current news from the database: loadVariablesNum("SelectNews.php","0");

You should be able to add the 'FlashExample' folder (in the download) to your htdocs web root folder and have everything working right away - as long as the above steps in creating your database and table where followed above. 

The AddNews.php script contained in the download will take a User Entered Name and a news Item and add it to your newly formed table (news) in the Database (FlashTest) - when the 'Add News' button is pressed.

The SelectNews.php script will Select all of the news Items currently in the table (news) in the database (FlashTest) we just created and display them in your Flash movie.

Their is also a refresh button on the Flash client that will allow you to refresh the News area after you've added a new entry.

And I think that's about it.  Hopefully that small sample is at least something you can follow along with the Code in the scripts and Flash movie.

«prev 1 2 3 4 5 6 7 8 9 next»

» Level Advanced

Added: : 2002-05-08
Rating: 9.19 Votes: 107
Hits: 3275
» Author
Jeffrey Hill is a freelance web developer from Boulder, Colorado. He specializes in creating and developing dynamic database driven Flash content, applications, and content management systems. Specialty's include SQL, PHP, Perl, XML, web services, and Flash clients for web services.
» Download
Download the files used in this tutorial.
Download (30 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs