-1
<?php
$pdo = new PDO('mysql:host=localhost;dbname=leonzemaim', 'leonzemaim', 'leonzemaim');
$stmt = $pdo->prepare('SELECT * FROM Orders');
$stmt->execute();
?>

Hi. I try get my result in utf8 code?

1 Answers1

0

Simply add ;charset=utf8 to your connection string.

$pdo = new PDO('mysql:host=localhost;dbname=leonzemaim;charset=utf8', 'leonzemaim', 'leonzemaim');
Dave
  • 5,108
  • 16
  • 30
  • 40
  • It's not working for me... – Aleksandr Gvozdev Jan 16 '19 at 13:56
  • Is the collation of your orders table utf8? Are you setting the correct charset when displaying the data? Also take a look at [UTF-8 all the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through). – Dave Jan 16 '19 at 14:10