I suspect it's not the proxy, but rather the DNS that resolves the 127.0.0.1 to localhost (which is correct, actually).
The $db = mysql_connect($SESS_DBHOST, $SESS_DBUSER,$SESS_DBPASS) or die("Could not connect"); would only work if you had defined the same session variables as phpMyAdmin presumably does, but with your username and password. Of course I'm assuming that's <b>exactly</b> how your code goes. Now, suppose you had defined a user named 'admin' in the MySQL server with the password 'pass', you would naturally call the function: $db = mysql_connect('localhost','admin','pass') rather than use the session variables which you may or may not have defined.
I'll copy-paste you the exact code which connects me to the mysql database on my winxp:
$link = mysql_connect("localhost", "put your username here", "don't forget the password");
if (! $link ) die ("Could not connect: ".mysql_errno()." ".mysql_error());
if (mysql_select_db("database_name" ,$link) == false)
{
die ("Didn't find database");
}