Flash-php-mysql

hi all (first post :D)

well, i am using the book (foundation php for flash)
to make a registration script.

(background)
my host upgraded their version of php and switched register globals off (no idea if this has any relevance)

right, well i followed the tutorials as far as i can, i have been using flash for a while now, and i am pretty certain that flash is sending the variables that i need it to.

here is the php script which i am using

<? 
// config file 
include('common.php'); 

$link = dbConnect(); 
// search for dupe usernames 
$query = "SELECT * FROM tblMembers WHERE Username='$Username'"; 

if(!mysql_query($query)) { 
	fail("Couldn't search database for duplicates");  
	} 
// if a match was found 
	if (mysql_num_rows($query) != 0 { 

//inform flash of error and quit! 
	fail("Username $Username already registered");  
	} 
	 
//add user 
	$query = "INSERT INTO tblMembers (UserName, Password, Email, Location, Guild, Server, Class) VALUES ('$UserName', '$Password', '$Email', '$Location', '$Guild', '$Server', '$Class')"; 
	 
	if(!mysql_query($query)) { 
		fail("Username $UserName already exists"); 
		 
		//inform flash of success 
		print "&Status=Okay"; 
	//close link to db 
	mysql_close($link);	 
?>

i am a total newbie to php, so any insight on this would be great

at first, i thought that it would be the php which was letting me down. then my brother asked if i could finish off a shoutbox for him, (add the table and php files) followed directly from a perfect tutorial on the web. guess what, nothing is inputted into the database, just like my problem.

i am guessing that the script and tutorial are designed to work with an older version of php. :diss: soooo…

am i right, is there something i can add to make it work?

the php sends an error message back to flash if there are any problems, well, originally it was doing that, but only because i forgot to CHMOD the .php files, well, no error comes up now.