It's referring to your query. Does the table "tablename" exist? If not, it will give you errors if you're trying to select from it.. you have to create the table before you can select from it.

As for the password thing, unless your localhost uses a different port to connect through than the default, or requires you to use an actual address (ie: mysql.someserver.com), I'm not sure what's wrong, but it's something to do with MySQL and most likely not your PHP, because the code is fine. Only thing I could POSSIBLY think of is if you have variables in your mysql_connect and are enclosing them with single quotes. If a variable is in a single quote, the variable's value will not show up, but rather the actual text you typed will show up. If you're confused on what I mean, then here's an example:
PHP Code:
<?php
  $var 
"hello!";
  echo 
'$var';
  
//this will produce: $var
  
echo $var;
  
//this will produce: hello!
  
echo "$var";
  
//this will produce: hello!
?>
But, if you're just using plain text and entering your username/password/host directly, this should not be a problem.