I have a php file which has to authenticate user login data against a database of a forum software. I have problems selecting the right row of the members table for usernames which use German special chars like ä, ö, ü - It can't find the according row. However if I do the same query with MySQL workbench I can find the according member. Thus I think there is a problem with the PDO connection or my php file.
PHP Part to select the member row:
/* Get all Member attributes for the username */
$query = $db->prepare("SELECT * FROM members WHERE members_l_username = :name");
$query->bindValue(':name', $username);
$query->execute();
$member = $query->fetch(PDO::FETCH_ASSOC);
Creation of the PDO Object:
try {
$db = new PDO("mysql:host=$dbhost;port=3306;dbname=$dbname;charset=utf8", $user, $pass);
}catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
Why I can't find the row for $username="Mark Fröst" even though it exists (and the query works with MySQL workbench)?