#native_company# #native_desc#
#native_cta#

Using PHP and MySQL with Flash Page 3

By Jeffrey F. Hill
on December 14, 2001

Short List of Column types:

(Note: if the data that you have entered into one of these definitions is larger then the amount you specified in the table it will be cut off.)
varchar (Number)
A variable text type. In my opinion the easiest and most flexible to use when first starting out.
char (number)
A fixed character type column. Uses less space if all the characters in that column are always the same.
int (number)
A fixed integer type column.
text or blob
Use either when you want to enter a large amount of text. Blob is case-sensitive; Text is not.

Part II – Setting up the PHP

The PHP scripts will be better explained by reading the comments in the attached files. Just open up the PHP script with notepad or any other text editor to make changes.
The first thing we have to do is connect to the database. You will need to know your database name, account username, and database password. In order to keep this as simple as possible use an include file to list these variables. They will be the same for each one of your scripts. This is what is contained in the file Include.inc. One thing to note is that sometimes the $DBhost variable is slightly different then “localhost” — sometimes it can be “localhost.yourHost.com” or “mysql.yourHost.com”.

$DBhost = "localhost";
$DBuser = "UserName";
$DBpass = "DatabasePassword";
$DBName = "DatabaseName";
$table  = "saveMovie";

You will notice that at the top of each PHP script there is a line of code something like this: include (‘Include.inc’); All this does is to include those variables in the script. It’s just an easier way of keeping track of everything.
Next you want to make a connection to the Database:

mysql_connect($DBhost,$DBuser,$DBpass);
@mysql_select_db("$DBName");
You can see how the variables in the Include File are used here. I’m only going to go over in detail the SQL query part of each script. The rest you should be able to figure out by reading through the comments in the File. Also note that for simplicity some basic security precautions where left out. These are not necessary but you might want to include them if you have any type of sensitive data.

1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9