I try to execute a query in PHP using PDO on Sqlite which may contain special characters (Ä,Ö,Ü,...). But I fail to execute the query. PHP returns the following Error:
array(3) { [0]=> string(5) "00000" [1]=> int(1) [2]=> string(35) "unrecognized token: "'MÄÖÜ123DE"" }
I tried to execute the query native and also in the way to use preparing statement and binding values.
$statement = "select * from list where param = ? and value = ?";
$stmt = $db->prepare($statement);
$stmt->bindValue(1, $setparam);
$stmt->bindValue(2, $val,PDO::PARAM_STR);
$stmt->execute();
Native way:
$statement = "select * from list where param = '".$setparam."' and value = '".$val."'";
$res = $db->query($statement);
Both ways return the same error. I use XAMPP 1.8.3-5. The used coding ist UTF-8. In sqlitestudio the query works well.
EDIT Execute PDO:
$db = new PDO("sqlite:database/lists.db","","",array(
PDO::ATTR_PERSISTENT => true));
The used UTF-8 HTML meta execution:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />