Flash+php+mysql Simple message Book production

Source: Internet
Author: User
Tags php file php server php and php and mysql mysql database phpmyadmin

This article is not a perfect version, if you just want to use this source file is not recommended, but if you want to learn the production principle of the flash message, this article may be of great help to you!

Other Flash message primitive files can go here to download

Flash+php+mysql Simple Message This tutorial

Objective:

Use Flash+php+mysql to make a simple message book.

Configuration environment:

It must be the first to configure the appropriate environment. I downloaded the configuration of the environment package, a fool-style method, simple installation, more suitable for me. (including: Apache, PHP, MySQL, Zend Optimizer, phpMyAdmin, Eaccelerator)

The folder is described below (init.cmd installation; Pncp.cmd Control Panel. ):

Apache folder: PHP server (similar to IIS).

mysql-5.0.15b folder: MySQL database server.

Data folder: The site database is stored. (The database of the message is stored here, backstage)

Bin folder: Files inside to manipulate the database (DOS mode)

Php-5.2.6-win32 folder: PHP's function library, using Apache to explain.

Zendoptimizer folder: accelerates PHP execution.

Htdoc (or WWW): Store Web page files. (The homepage of the message is placed here, the front desk)

phpMyAdmin folder: Manipulating the database (Windows way)

Note:

1, installation will prompt you to enter the MySQL database password, where the password to "Sun" as an example. (User name is "root")

2, the browser input "http://127.0.0.1" after the display configuration information, you can enter the MySQL password for connectivity testing.

3, the Site Directory index is closed by default, using the console to open it, easy to later on the site (message board) test.

Knowledge preparation (train of thought):

1, first introduction how to use PHP to connect the database (database username "root", password "sun", there is a library "Myguestbook")

2, PHP and MySQL communications (SQL statements: Insert save, select take):

Php←mysql:select * from Myguestbook;

Php→mysql:insert into Myguestbook (name,comment) VALUE ("John", "This is a message");

3, SWF and PHP communication (Loadvars class of the Sendandload method to save, parse XML way to take):

swf←php:php writes an XML file with Echo, and the SWF resolves the file directly. (I used to wonder why the blue RSS is in PHP format, so I learned it here.) )

SWF→PHP:SWF uses "Sendandload" (data_lv.uname= "John") to send variables, and PHP receives variables with $name=$_post[' uname '.

Note:

1, the message is actually the two small process, PHP is equivalent to a bridge. It is strongly recommended to write a simple example of both 2 and 3, and the example runs successfully, and the message book has been completed half without beginning to write.

2, Sendandload can send variables to PHP, but also can receive PHP variables (similar to the SWF read text). Can see the volcano's tutorial, very detailed.

Start production (do the above preparation, the following will be very well understood):

1. SWF reads data

① and ②mysql→php→swf

PHP takes "select" from MySQL and writes XML to the SWF for reading.

2, SWF storage data

③ and ④swf→php→mysql

SWF with "Sendandload" to php,php with "INSERT" to MySQL.

After the screenshot is completed:

Additional considerations:

Solve garbled (solve the database in Chinese read out is "????") :

Select "Utf8-geeral-ci" encoding when using Phpadmin to build a database.

In the PHP file before the query statement, plus: mysql_query ("Set names ' UTF8 '");

PHP modularity (easy to modify later):

The statement that connects the database is written in a separate file, such as connectdb.php.

In the file of write data (datatosql.php) and read data (datatoxml.php), add: Require "connectdb.php".

MySQL error-correcting functions (such as Operation Error, according to the prompt will be very convenient to modify):

Mysql_errno (Error number); Mysql_error (cause of error).

PHP Date Functions (more detailed reference to other help):

Data ("Ymd,l,h:i"); 20080608,sunday,09:28

SWF Real-time refresh (guaranteed to read the latest data):

SWF sends and gets real-time variables: data_lv.sendandload ("datatosql.php?n=" +random (9999), DATA_LV, "post");

SwF reads Live xml:myXML.load ("datatoxml.php?n=" +random (9999));

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.