Файловый менеджер - Редактировать - /var/www/jonas-eriksen.dk/anfald/database_anfald.php
Назад
<?php class database{ private $conn; function __construct() { $servername = "mysql63.unoeuro.com"; $username = "jonas_eriksen_dk"; $password = "4925wzcg"; $dbname = "jonas_eriksen_dk_db"; $this->conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } public function test() { echo 'test'; } public function get_latest_input() { try { $stmt = $this->conn->prepare("SELECT * FROM anfald ORDER BY date DESC LIMIT 1;"); $stmt->execute(); $result = $stmt->setFetchMode(PDO::FETCH_ASSOC); return $stmt->fetch(); } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } } public function get_all() { try { $stmt = $this->conn->prepare("SELECT * FROM anfald ORDER BY date DESC;"); $stmt->execute(); $result = $stmt->setFetchMode(PDO::FETCH_ASSOC); return $stmt->fetchAll(); } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } } public function insert($date, $faint, $twitch, $feeling, $comment) { try { $stmt = $this->conn->prepare("INSERT INTO anfald (date, faint, twitch, feeling, comment) VALUES (UNIX_TIMESTAMP(:date), :faint, :twitch, :feeling, :comment)"); $stmt->bindParam(':date', $date); $stmt->bindParam(':faint', $faint); $stmt->bindParam(':twitch', $twitch); $stmt->bindParam(':feeling', $feeling); $stmt->bindParam(':comment', $comment); $stmt->execute(); } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Генерация страницы: 0.06 |
proxy
|
phpinfo
|
Настройка