Server IP : 66.29.132.124 / Your IP : 3.137.170.76 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/tacafoundation.org/sacbradescolivelo/_dashboard2021/_classes/ |
Upload File : |
<?php class Database{ private $connstr = 'sqlite:'.DB_HOST; protected $conn; public function __construct(){ $this->conn = null; try{ $this->conn = new PDO($this->connstr); $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $this->conn; }catch(PDOException $e){ exit("Connection error: {$e->getMessage()}"); } } public function adicionar($table, $fields, $values, $binds = null){ $stmt = $this->conn->prepare("INSERT INTO {$this->tabela} ({$fields}) VALUES ({$values})"); ($binds == null) ? $stmt->execute() : $stmt->execute($binds); return ($this->conn->lastInsertId()) ? $this->conn->lastInsertId() : false; } }