Answer the question
In order to leave comments, you need to log in
How to change encoding of sql query in OpenServer?
I am querying the database using pdo.
$dsn = 'mysql:host=localhost;dbname=f5_shop';
$pdo = new PDO($dsn, 'root', '');
$quere = $data['search_request'];
$sql = 'SELECT * FROM `remont` WHERE `:type` = `:link`';
$query = $pdo->prepare('SELECT * FROM `remont` WHERE `:type` = `:link`');
$query->execute(['type' => $type_a, 'link' => $quere]);
Answer the question
In order to leave comments, you need to log in
The fact is that the author of OpenServer slipped a trick into the MySQL configs.
In order for the encoding change to work in PDO when using OpenServer, you need to remove the init-connect parameter from the MySQL configs there, which, like a rat, changes the encoding to another without notifying PDO in any way.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question