Add Config from local project
Browse files- config/DataAccess.php +29 -0
config/DataAccess.php
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class DataAccess
|
| 3 |
+
{
|
| 4 |
+
private $host = getenv("TZ_HOST");
|
| 5 |
+
private $username = getenv("TZ_USER");
|
| 6 |
+
private $password = getenv("TZ_PASSWORD");
|
| 7 |
+
private $dbname = getenv("TZ_NAME_DATA_BASE");
|
| 8 |
+
|
| 9 |
+
private $conection;
|
| 10 |
+
|
| 11 |
+
public function __construct()
|
| 12 |
+
{
|
| 13 |
+
$this->conection = new mysqli($this->host, $this->username, $this->password, $this->dbname);
|
| 14 |
+
if ($this->conection->connect_error) {
|
| 15 |
+
die('Error de Conexión (' . $this->conection->connect_errno . ') ' . $this->conection->connect_error);
|
| 16 |
+
}
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
public function executeQueryGet($queryExecue)
|
| 20 |
+
{
|
| 21 |
+
return $this->conection->query($queryExecue);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
public function closeConection()
|
| 25 |
+
{
|
| 26 |
+
$this->conection->close();
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
?>
|