URL link from MySQL using PHP

Hi all,

I have been using Flash, PHP and MySQL intergration for the first time and have been having some luck with it, although having a few problems along the way.
The problem I have at the moment is this:
I have a Flash client login at the site www.brandnew.cc (clients section)
When the user enters their username and password, they are checked against a MySQL database using PHP. I have been able to get this working fine. The problem is I want a URL to open in a new window/tab once the username and password have been verified. This URL will be related to the user and so will be included in my database.

My database currently has 3 fields; username, userpassword and url.
So for example, entry number one reads: roymuir, 12345, http://www.roymuir.com

Basically I need the flash file or PHP to open the url (http://www.roymuir.com) once the username, roymuir, and the password, 12345, have been verified.

Here’s my PHP code:

 <?
ini_set('display_errors', true);
$username="$user";
$password="$pass";

//connect to database
$connect2 = mysql_connect("127.0.0.1", "brandnew", "89CBqmqyp");
mysql_select_db("brandnewlogin", $connect2);
//make query
$query = "SELECT * FROM logindetails WHERE username = '$username' AND userpassword = '$password'";
$result = mysql_query( $query ) or die ("didn't query");

//see if there's an EXACT match
$num = mysql_num_rows($result);
if ($num == 1){
print "statustext=You're in&checklog=1";
} else {
print "statustext=Sorry, but your user name and password did not match a user name/password combination in our database. Usernames and passwords are entered in from a different file. Thank you for visiting test login script!!&checklog=2";
}
?>

and here is my Flash code:

this.onEnterFrame = function() {
    if (_root.checklog == 1) {
        this.gotoAndStop(2);
    }
    if (_root.checklog == 2) {
        this.gotoAndStop(3);
    }
};
submit_mc.onRelease = function() {
    userName = userinput.text.toLowerCase();
    passWord = passinput.text.toLowerCase();
    loadVariablesNum("login.php", 0, "POST");
};
clear_mc.onRelease = function() {
    userinput.text = "";
    passinput.text = "";
};
userinput.restrict = "a-zA-Z0-9";
passinput.restrict = "a-zA-Z0-9";
Selection.setFocus(userinput);
userinput.tabIndex = 1;
passinput.tabIndex = 2;
stop();

if anyone could help me out, I would be super appreciative,

enforcer73