summaryrefslogtreecommitdiff
path: root/Lab04/create_table.php
diff options
context:
space:
mode:
Diffstat (limited to 'Lab04/create_table.php')
-rw-r--r--Lab04/create_table.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/Lab04/create_table.php b/Lab04/create_table.php
index 1cc0069..a704d5e 100644
--- a/Lab04/create_table.php
+++ b/Lab04/create_table.php
@@ -1,9 +1,15 @@
<?php
-$servername = "db";
-$username = "example";
-$password = "example";
-$database = "regformdata";
-$tableName = "regtable";
+require __DIR__ . '/vendor/autoload.php';
+
+use Dotenv\Dotenv;
+$dotenv = Dotenv::createImmutable(__DIR__);
+$dotenv->load();
+
+$servername = getenv('DB_SERVER');
+$username = getenv('DB_USERNAME');
+$password = getenv('DB_PASSWORD');
+$database = getenv('DB_NAME');
+$tableName = getenv('DB_TABLE');
// Create connection
$conn = new mysqli($servername, $username, $password);
@@ -35,4 +41,4 @@ if ($conn->query($sql) === TRUE) {
}
$conn->close();
-?> \ No newline at end of file
+?>