connect_error){ die("Ошибка подключения". $mysql->connect_error); } session_start(); $id = $_SESSION['id']; $query = "INSERT INTO reviews (review, rating, id_user) VALUES ('$review', '$rating', '$id')"; $result = $mysql->query($query); if(!$result){ echo "Что то не так" . $mysql->error; } else{ session_start(); $message = "Пользователь ".$_SESSION['login']. " оставил отзыв: ".$review.". Оценив сайт на " .$rating. "звёзд"; $query = "SELECT * FROM Login Where role = 1"; $result = mysqli_query($mysql, $query); While($rivews = mysqli_fetch_assoc($result)){ $from = "provalenkoludmila@gmail.com"; $subject = "Новый отзыв на сайте"; $subject = "=?utf-8?B?".base64_encode($subject)."?="; $headers = "From: $from\r\nReply-to: $from\r\nContent-type: text/html; charset=utf-8\r\n"; mail($rivews['email'], $subject, $message, $headers); } echo ""; } ?>