When I open a MySQL connection in PHP with just PHP\'s built-in MySQL functions, I do the following:
$link = mysql_connect($servername, $username, $password)
Well seeing as the $link
for the PDO is assigned an object, PHP would set that as null as soon as the script runs so that it's no longer an object. Therefore you could just do:
$link = new PDO("mysql:dbname=$dbname;host=$servername",$username,$password);
//prepare statements, perform queries
$link = null;