I'm trying to get local characters č ž đ...
from MySql database.
On localhost the problem doesn't exists, but on remote server the local characters are missing.
Database and table collation is utf8_general_ci (according to one answer here )
my connection:
try {
$db = new PDO('mysql:host='.DBHOST.';dbname='.DBNAME.';charset=utf8_general_ci', DBUSER, DBPASS);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $e) {
echo $e->getMessage();
exit;
}
here I have the error - Unknown character set
. Writing only charset=utf8
the error is removing, but this doesn't help about local characters.
edit.php
include ("menut.php");
SET character_set_client = "utf8"; //line 12
SET character_set_results = "utf8";
SET collation_connection = "utf8_general_ci";
$stmt = $db->prepare("SELECT id, title, content FROM $table WHERE id = :id");
$stmt->execute(array(':id' => $_GET['id']));
$row = $stmt->fetch();
Here I have the error - Unexpected T String
on line 12 (marked abowe).
Any help.