my MySQL database is set to utf8_unicode_ci and I have $pdo->exec('SET NAMES "utf8"') as part of the following php code yet when I echo text from the query a hyphen - looks likes this –. What am I doing wrong, why is the hyphen not displaying correctly?
<?php
try {
$pdo = new PDO('mysql:host=localhost;dbname=danville_tpf', 'danville_dan', 'password');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->exec('SET NAMES "utf8"');
} catch (PDOException $e) {
$output = 'Unable to connect to the database server.';
include 'output.html.php';
exit();
}
$output = 'Theme Park Database initialized';
//include 'output.html.php';//
try {
$park_id = $_GET['park_id'];
$query = "SELECT * FROM tpf_parks WHERE park_id = $park_id";
$result = $pdo->query($query);
} catch (PDOException $e) {
$output = 'Unable to connect to the database server.';
//include 'output.html.php';//
}
$output = 'Sucessfully pulled park';
//include 'output.html.php';//
foreach ($result as $row) {
$parkdetails[] = array(
'name' => $row['name'],
'blurb' => $row['blurb'],
'website' => $row['website'],
'address' => $row['address'],
'logo' => $row['logo']
);
}
?>
Please help.