Code: Select all
try {
$dbh = new PDO('mysql:host=localhost;dbname=mydb', $user, $pass);
$dbh->exec("SET CHARACTER SET utf8");
$dbh = null;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}

I'm trying to make an autocomplete field, so I need to bring data as json encoding from another database