0
I have a PHP PDO connection with two databases, however, I’m having problems with the special characters of both. How to solve?
$host = "localhost";
$user = "user";
$password = "";
$database1 = "bd1";
$database2 = "bd2";
try {
$dbh1 = new PDO("mysql:host=$host;dbname=$database1", $user, $password);
} catch(PDOException $e) {
die('Could not connect to the database:' . $e);
}
try {
$dbh2 = new PDO("mysql:host=$host;dbname=$database2", $user, $password);
} catch(PDOException $e) {
die('Could not connect to the database:' . $e);
}
?>
Remember: charset same in the bank and in the application. See if this helps: Doubt with charset=iso-8859-1 and utf8.
– ShutUpMagda