123456789101112131415161718192021222324 |
- <?php
- $host = "provalgk.beget.tech";
- $username = "provalgk_user";
- $password = "Qwer123.";
- $database = "provalgk_user";
- $mysql = new mysqli($host, $username, $password, $database);
- // Проверка соединения
- if($mysql->connect_error){
- die("Ошибка подключения". $mysql->connect_error);
- }
- $file = fopen('Statisic.csv', 'w');
- fwrite($file, "\xEF\xBB\xBF");
- fputcsv($file, array("Логин". ";". "Комментарий". ";". "Оценка"));
- $result = mysqli_query($mysql, "SELECT * FROM `reviews`");
- While($rivews = mysqli_fetch_assoc($result))
- {
- $login = $rivews['id_user'];
- $result1 = mysqli_query($mysql,"SELECT login from Login where id_user=$login");
- $login_user = mysqli_fetch_assoc($result1);
- fputcsv($file, array($login_user['login']. ";". $rivews['review']. ";". $rivews['rating']));
- }
- fclose($file);
- header('Location: Adminpage.php');
- ?>
|