Mysql Database Connection Using PDO?

DB Connection Using PDO $host = "localhost"; $username = "root"; $password = ""; $conn = new PDO("mysql:host=$host;dbname=myDB", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected successfully";

Advertisements