Mysqli错误结果但在数据库中的ok中查询[重复]

This question already has an answer here:

I'm having problem getting my id from a query who is working in my database but with this code gives 0 instead of 14

This is the code

    <?php

error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors', '1');
$mysqli = new mysqli('localhost', 'xxxxx', 'xxxxx');
if (mysqli_connect_errno()) {
    trigger_error('Database connection failed: ' . mysqli_connect_error(), E_USER_ERROR);
}
$turmas = $_GET['turmas'];

$sql = "SELECT  `id_turma` FROM  `ebspma_paad_ebspma`.`turmas` WHERE `turma` = ?";
$stmt = $mysqli->prepare($sql);
if ($stmt === false) {
      trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $mysqli->error, E_USER_ERROR);
}
$stmt->bind_param('s', $turmas);
$stmt->execute();
$stmt->bind_result($idturma);
$stmt->fetch();
$stmt->close();

Anyone can see why? I have no errors in my console

</div>

I have fix this issue using

$mysqli->set_charset("utf8");

Thanks for all your apports.

Best regards