Fatal error: Uncaught Error: Cannot use object of type mysqli_result as array in /home/c/пользователь/public_html/auth.php:10
Stack trace:
#0 {main}
thrown in <b>/home/c/пользователь/public_html/auth.php on line 10
Вот мой код:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$name = json_decode(file_get_contents('php://input'),true);
$code = $name['text'];
$con = mysqli_connect("localhost","cj28778_test","Nikita123","cj28778_test") or die('Не удалось подключиться');
$query = mysqli_query($con, "SELECT code FROM `code` WHERE `code` = '$code'");
$res = $query->fetch_array();
printf($query['code']);