Php code mysql

Hello Everyone, I am new to php so i am looking for some advice from you guys.
I am wanting building a login system in Flash for my website. So every new user i can organize and store information into the mysql database.
The database and table i have already created. My table has 4 coulumns id, username, password and email.
I have two ActionScript 3.0. fla files login and register i have a general idea how to code these files.
However, when it come’s to the php file i am struggling . My code is below i know it probably has errors in because i am complete novice to php. I would appreciate it if you could highlight the mistakes and tell me if there is anything missing in the file that should be there. I don’t expect you to do all the work for me im just some advice. Thanks.

<?php

//Declare variables
$username = $_POST['username'];
$password = $_POST['password'];
//
//mysql connection variables
$email = $_Post['email'];
$username = $_POST['username'];
$password = $_POST['password'];
$age = $_POST['age'];
$country = $_POST['location']
//

//connects to database
$link = mysql_connect("localhost","example_database","password") or die (mysql_error());
mysql_select_db("example_users") or die(mysql_error());
?>

$email = $_Post['email'];
$username = $_POST['username'];
$password = $_POST['password'];
$age = $_POST['age'];
$country = $_POST['location']


//collects data from table
$data = mysql_query("SELECT * FROM users");
$results = mysql_query($query)
or die(mysql_error());

//put users info into the $info array
$info = mysql_fetch_array( $data ))

$userbio = $data["name"];

echo "systemResult=$userbio";


}

} else {

echo "systemResult=The login detail dont much our records

}
?>

Hi,
Try this code. Replace the connection data (in mysql_connect() ) and the name of the columns with your data.

<?php 
//Declare variables
$email = $_Post['email'];
$username = $_POST['username']; 
$password = $_POST['password']; 
$age = $_POST['age'];
$country = $_POST['location'];
 
//connects to database
$link = mysql_connect("localhost", "user_name", "password") or die (mysql_error());
mysql_select_db("database_name") or die(mysql_error());
 
 
//collects data from table
$data = mysql_query("SELECT * FROM users WHERE col_username='$username' AND col_password='$password'");
if (mysql_num_rows($data) == 0) {
  echo "systemResult=The login detail dont much our records";
}
else {
  while ($row = mysql_fetch_assoc($data)) {
    $userbio = $row["name"];
    echo "systemResult=$userbio";
  }
}

Also be sure to add filter_var and mysql_real_escape to your code to secure it up a bit more.

Thank you both for your replys. I appreciate it! Your advice was awesome.

Also, stop using mysql_ and move to either mysqli_ or a PDO object; the mysql library is discouraged from use.