1

I want to insert 'Gujarati' language data into table using PDO statement. I've already one separate column in a table witch stores Gujarati names for a product. This works fine when I directly inserts data through PhpMyAdmin but when I attempt to update that column through PDO statement from a php file, it updates value with different characters. I've already set character set as utf 8 in both the files but still it doesn't update the value properly. Value in Gujarati language is properly coming in a file where query is executed. I tried echoing it, but just in Database, different character set is coming up.

$gujarati=$_POST['gujarati'];
$db->query("set character_set_results='utf8'");
echo $gujarati;  // This is printing Gujarati name perfectly fine
$query=$db->prepare("update products set name_gujarati=:gujarati where
productid=:productid limit 1");
...
$query->execute();

What is updating is this કારેલા. Any solution to this? I'm not able to find out any.

Guy in the chair
  • 1,045
  • 1
  • 13
  • 42

0 Answers0