The simple example to test connection via PDO is below:
<?php
$servername = "database server";
$username = "username";
$password = "password";
try {
$conn = new PDO("mysql:host=$servername;", $username, $password);
echo "connected!";
}
catch(PDOException $e)
{
echo $e->getMessage();
}
?>
One reply on “MySQL connection string via PDO”
Hi, this is a comment.
To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.
Commenter avatars come from Gravatar.