Something along these lines
<?php
/*I have two databases, 'memoryx' and 'memoryxchal'. What I want my script to do is-
1. Checks to make sure their username is not in table $xx in memorychal. If it is, it dies.
2. Writes their name INTO table $xx in memorychal.
3. Then on memory, it will call up their info using their
$user and $pass, get fields 'points' and 'challenges', adds $yy to points,
$nn to challenges, then writes those values back in.
*/
$conn = mysql_connect("host","user","pwd");
mysql_select_db("memoryxchal",$conn);
$sql = "select username from $xx where username='$username' ";
$result = mysql_query($sql);
if (mysql_num_rows($result) != 0) {
die("Username exists");
} else {
mysql_query("insert into $xx (username) values ('$username')");
}
mysql_select_db("memoryx",$conn);
$sql = "UPDATE info SET point = points + $yy, challenges = challenges + $nn
WHERE username = '$user' AND password = '$pass' ";
mysql_query($sql);
?>
hth