Integrating flash with phpmyAdmin

I have a database in phpMydmin and created a table called “users”. The table has six columns id, username, password, age, gender and country.

In Flash, i have a register.php and a login.php files. My question is, how does Flash connect to the database and activate it?
In both the files i have created all the user interface components stuff like email address, password, input text fields, submit button etc
I have never studied php code before so i would ask you all to have a close look at my register.php file below to see if there any errors. Thank you.

hostname",“username”,“password”,“age”,“gender”,“country”, ) or die();
mysql_select_db(“databasename”) or die();
$usercheck = $_POST[‘username’];
$check = mysql_query(“SELECT username FROM users WHERE username = ‘$usercheck’”)
or die();
$check2 = mysql_num_rows($check);
if ($check2 != 6) {
print “words=Username already exists.&checklog=1”;
die();
}
$insert = “INSERT INTO users (username, password)
VALUES ('”.$_POST[‘username’].“', '”.$_POST[‘pass’].“')”;
$add_member = mysql_query($insert);
print “words=You are registered.&checklog=2”;
die();
?>