Integration with MySQL in flash PHP

Source: Internet
Author: User
Tags mysql in php file php and php and mysql mysql database

Integration with MySQL in PHP

Integration with MySQL in flash and PHP
By Ben Smith, a. k. a Ω mega: May 12, 2005
This tutorial teaches you how to integrate flash, PHP, and MySQL. We will learn how to parse text into HTML text from external script files. This will use PHP file parsing text from a MySQL database to make it a kind of code which will also be decoded.

Just as I cannot use my own MySQL database here, I will provide examples and Flash screens that show the image. Please note that to complete this tutorial, you need a PHP-Enabled Server, MySQL database, and Flash MX (August 1, 2004 ).

Flash, PHP, and MySQL integration
By Ben Smith, a. k. a Ω mega: May 12, 2005
This tutorial teaches you how to integrate flash, PHP, and MySQL. We will learn how to parse text into HTML text from external script files. This will use PHP file parsing text from a MySQL database to make it a kind of code which will also be decoded.

[For example, you will create to display external links on my website]

Let's get started!
The following steps will show you how to create a dynamic Flash list.

Create a flash in a new document, press Ctrl + J (Command + J on Mac) and set the base size of PX (you can change the size to meet your needs, but this is my use ).

Create a new layer called Website, create a text tool used on the dynamic text box layer, and name it sites_txt. Make sure the HTML format is!



[The content in the text box should look like "" button in HTML format]

Now, we need to create an archive action, so create a new script file by clicking the File> "new"> script file.

Part of the fun now, encoding! Insert the script file to this point and save it as sites. as the code will be explained later:

Function lv (l, n, t, e, f ){
If (l = undefined ){
L = new LoadVars ();
L. onLoad = function (){
Var I;
N.html Text = "";
If (t = undefined ){
N.html Text + = "<B>" + this ["title" + e] + "</B> <br> ";
} Else {
For (I = 0; I <this. n; I ++ ){
N.html Text + = "<a href = '" + this ["link" + I] + "'>
"+ This [" title "+ I] +" </a> <br> ";
}
}
};
}
L. load (f );
}
Lv (sites_txt, "cycle", null, "sites. php ");

As you can see, the script file requires. Php file (sites. php) work, make the fire action webpage/notepad or any other text editor, and paste it in this code:

<? Php
Mysql_pconnect ("host of your SQL server", "your SQL USERNAME", "YOUR PASSWORD ");
 
Mysql_select_db ("the database you want to use ");
$ QResult = mysql_query ("SELECT * FROM sites order by id ASC ");
$ NRows = mysql_num_rows ($ qResult );
$ RString = "& n =". $ nRows;
For ($ I = 0; $ I <$ nRows; $ I ++ ){
$ Row = mysql_fetch_array ($ qResult );
$ RString. = "& id ". $ I. "= ". $ row ['id']. "&". "& title ". $ I. "= ". $ row ['title']. "&".
"& Link". $ I. "= http: //". $ row ['link']. "&";
}
Echo $ rString ."&";
 
?>

You will see that if you run this file, it will not work, we need to make a table named website in our database, so if you are willing, you can use this SQL query code to create one or your own.

Create table 'sites '(
'Id' int (11) not null auto_increment,
'Link' varchar (100) not null default '',
'Title' varchar (100) not null default '',
Primary key ('id ')
) TYPE = MyISAM AUTO_INCREMENT = 19;
Insert into 'sites 'values (5, 'www .kirupa.com ', 'kirupa ');
Insert into 'sites 'values (4, 'www .voetsjoeba.com ', 'voetsjoeba ');
Insert into 'sites 'values (3, 'www .cannedlaughter.net ', 'canned Laughter ');
Insert into 'sites 'values (6, 'www .spoono.com ', 'spoono ');
Insert into 'sites 'values (7, 'www .readymademag.com ', 'readymademag ');
Insert into 'sites 'VALUES (9, 'www. weebl. jolt. co. uk', 'weebl and Bob ');
Insert into 'sites 'VALUES (10, 'www .aamukaste.org ');
Insert into 'sites 'values (12, 'www .flipflopflyin.com ', 'Flip Flop Flyin ''');
Insert into 'sites 'values (15, 'www .kirupaforum.com ', 'kirupaforum ');
Insert into 'sites 'VALUES (16, 'www .razyr.com/blog', 'razyr ');
Insert into 'sites 'VALUES (17, 'senocular. Com', 'senocular ');
Insert into 'sites 'values (18, 'www .may1reboot.com ', 'may 1st reboot ');

Now, you are all set up, so let's include files to our Flash files. Return to your Flash schedule, create an operation layer, and enter the following code in the first frame:

# Include "sites. ";
Now, you are all set up, so let's include files to our Flash files. Go back to your Flash schedule and create an action. If this tutorial does not work, check that you have a server that can be used for PHP and MySQL. If you do so, feel free to contact me!
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.