Program:
Output:
<?php $host = "localhost"; $user = "root"; $pass = "1234"; try { $conn = new PDO("mysql:host=$host;dbname=employees",$user,$pass); $conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); echo "Connected Successfully"; } catch(PDOException $e) { echo "Connection Failed:".$e->getMessage(); } ?>
Output: