{"1808-0101-2":{"order_id":"1808-0101-2","products":[{"prod_name":"\u0422\u043e\u0432\u0430\u0440 5","prod_qty":"3","prod_price":"300","total":"2600","delivery_date":"2018-12-26 21:15:30"},{"prod_name":"\u0422\u043e\u0432\u0430\u0440 6","prod_qty":"4","prod_price":"400","total":"2600","delivery_date":"2018-12-26 21:15:30"}]},"1808-0101-3":{"order_id":"1808-0101-3","products":[{"prod_name":"\u0422\u043e\u0432\u0430\u0440 1","prod_qty":"2","prod_price":"100","total":"400","delivery_date":"2018-12-29 18:30:00"},{"prod_name":"\u0422\u043e\u0432\u0430\u0440 2","prod_qty":"1","prod_price":"200","total":"400","delivery_date":"2018-12-29 18:30:00"}]}}
function total_score($id){
global $connection;
$query = "SELECT COUNT(`id`) as history_user_count, `email`, MAX(`date`), (SELECT COUNT(id) FROM lesson WHERE id_course = '$id') as lessons FROM `history` WHERE 1 GROUP BY `email` HAVING lessons =< history_user_count";
$res = mysqli_query($connection, $query);
$total_score = array();
while($row = mysqli_fetch_assoc($res)){
$total_score[$row['id']] = $row;
}
return $total_score;
}
mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in "while($row = mysqli_fetch_assoc($res)){"
вот куда выводится всё добро: