JSFiddle - React, Tailwind, and code Playground
by Vaibhav Mehta
JavaScript
<?php
class Engine {
private $get_file;
private $connection;
public function log_error($filename, $error) {
$this->get_file = file_get_contents($filename);
$this->get_file .= $error."\r\n";
file_put_contents($filename, $this->get_file);
}
public function connection() {
try {
$this->connection = new PDO('mysql:host=localhost;dbname='.Config::LOCAL_DB, Config::LOCAL_USERNAME, Config::LOCAL_PASSWORD);
$this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
} catch(PDOException $error) {
$this->log_error('err.txt', $error);
}
}
}