PDO Connection problem

[email protected] (Jim Giner) Fri, 10 Jan 2014 10:13:00 -0500
Newsgroups php.db
Message-ID <[email protected]>
History:
I'm trying to help a friend who is hosting his domain with the same 
company that I use.  I've been using this company for several years and 
have used a certain 'connection' script all the time.  Part of it looks 
like this:

$host="mysql:host=mydomain.com;dbname=$sc_dbname;charset=utf8";
$uid = "uid";
$pswd = "pswd";
Try
{
	$mysql = new PDO($host,$uid,$pswd,$db_options);
}
.....

So - when I tried to provide this template to my friend (who is new to 
all of this) we went thru days of emails trying to make sure everything 
was setup correctly but could never get a connection using the above 
code.  Finally last night, after reviewing how my 'old' mysql interface 
connection worked, I experimented with the above changing my host= from 
my domain name to simply 'localhost'.  Voila - it worked for him.  It 
also worked for my site.

Here's my question:  What would make by friend's account not work when 
referencing a true domain name in the host= attribute?  I'm assuming 
that our (shared) provider is setting up his many accounts & servers the 
same way, but I could be wrong.  And of course, I don't have a clue 
about what makes any of this work - I simply follow 
instructions/guidance I get from manuals and searches until I get things 
to work.  That's how I got his account to finally work, but I'd love to 
have an idea why it now does.