Move some files and add a swear filter
This commit is contained in:
1 parent
d3df324642
commit
5777bf41b0
6 files changed
+11
-7
No files matched your search
+15
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
function connectToDatabase() {
|
||||
include __DIR__ . "/../config/connection.php";
|
||||
try {
|
||||
$dsn = "mysql:host=$dbhost;dbname=$dbname;port=$dbport";
|
||||
$options = [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
];
|
||||
$conn = new PDO($dsn, $dbusername, $dbpass, $options);
|
||||
} catch (PDOException $e) {
|
||||
die("Failed to connect to database: " . $e->getMessage());
|
||||
}
|
||||
return $conn;
|
||||
}
|
||||
Reference in new issue
Block a user