If you are going to call open_db(), which does setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION), you should probably put the test case in the try block and have a catch hander that prints any error message.