PHP + MYSQL + Flash as the message book (3) [group chart] start to make (make the above preparations and the following will be well understood ):
1. SWF reads data
① And ② MySQl → PHP → SWF
PHP uses "SELECT" to retrieve from MySQl and then writes xml to SWF for reading.
2. SWF stores data
③ And ④ SWF → PHP → MySQl
SWF uses "sendAndLoad" to PHP, and PHP uses "INSERT" to MySQl.
After completion:
Other considerations:
Solve the garbled text (solve the problem of reading Chinese in the database "???? "):
Select utf8-geeral-ci encoding when you create a database with PhpAdmin.
Before the php file query statement, add: mysql_query ("set names 'utf8 '");
Php modularization (easy to modify later ):
The database connection statement is written in a separate file, such as connectdb. php.
Add require "connectdb. php" to the file where data is written (datatosql. php) and data is read (datatoxml. php.
MySQL troubleshooting function (if the operation is incorrect, it will be easily modified as prompted ):
Mysql_errno (error number); mysql_error (error cause ).
Php date functions (for more details, refer to other help ):
Data ("Ymd, l, H: I"); // 20080608, Sunday
SWF real-time refresh (ensure to read the latest data ):
Swf sends and obtains the real-time variable: data_lv.sendAndLoad ("datatosql. php? N = "+ random (9999), data_lv," post ");
Swf reads real-time xml: myXML. load ("datatoxml. php? N = "+ random (9999 ));