-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnection.php
More file actions
28 lines (19 loc) · 799 Bytes
/
connection.php
File metadata and controls
28 lines (19 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
require __DIR__ . '/vendor/autoload.php';
use Dotenv\Dotenv;
$path = dirname(__FILE__);
$dotenv = Dotenv::createImmutable($path);
$dotenv->load();
$connection = new mysqli($_ENV["HOST"], $_ENV["USER"], $_ENV["PASSWORD"], $_ENV["DB"]) OR DIE("error");
if($connection->connect_errno){
echo "error" . $connection->connect_errno . " - " . $connection->connect_error;
}
// $result = $connection->query("INSERT INTO usuarios (name, password , user_email, date_of_birth) VALUES ('Teste','teste123', 'teste@gmail.com', '2000-01-01')");
// $result2 = $connection->query("SELECT * FROM usuarios");
// while($row = mysqli_fetch_assoc($result2)){
// echo $row["name"] . "<br>";
// // print_r($row);
// }
// $result.foreach($categorias as $categoria){}
// var_dump($_ENV["HOST"]);
?>