in your first example. . it would probably be this:
echo "<a href=\"java script:showstats( 'http://www.example.com/login.php?username=$row[Username]&password=$row[Password]' )\">Check Stats</a>";
in your second one, it would probably be this:
echo "showstats(\"http://www.example.com/login.php?username=user&password=pass\")";