setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // To turn on error mode for debugging errors $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); // To get maximum sql injection protection // echo "Connected successfully"; } catch(PDOException $e){ echo "Connection failed: " . $e->getMessage(); } ?>