removed dublicate pdo call
This commit is contained in:
@@ -28,24 +28,16 @@ session_start();
|
|||||||
|
|
||||||
// Initializes Database Connection
|
// Initializes Database Connection
|
||||||
try {
|
try {
|
||||||
$opt = [
|
$dsn = "pgsql:host=$host;dbname=$db;port=$port";
|
||||||
|
$pdo = new PDO($dsn, $user, $pass, [
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||||
PDO::ATTR_EMULATE_PREPARES => false
|
PDO::ATTR_EMULATE_PREPARES => false
|
||||||
];
|
]);
|
||||||
$dsn = "pgsql:host=$host;dbname=$db;port=$port;sslmode=disable";
|
|
||||||
$pdo = new PDO($dsn, $user, $pass, $opt);
|
|
||||||
|
|
||||||
|
|
||||||
$pdo = new PDO($dsn, $user, $pass, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Creates Error Message
|
// Creates Error Message
|
||||||
} catch(PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
echo "Error: ".$e->getMessage();
|
echo "Error: " . $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user