-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlibrary.php
More file actions
39 lines (30 loc) · 873 Bytes
/
library.php
File metadata and controls
39 lines (30 loc) · 873 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
29
30
31
32
33
34
35
36
37
38
39
<?php
//$SERVER = 'usersrv01.cs.virginia.edu';
//$USERNAME = 'ram8ny';
//$PASSWORD = 'Spring2021!!';
//$DATABASE = 'ram8ny';
//$con = new mysqli($SERVER, $USERNAME, $PASSWORD, $DATABASE);
//// Check connection
//if (mysqli_connect_errno()) {
// echo "Failed to connect to MySQL: " . mysqli_connect_error();
//}
//// Form the SQL query (an INSERT query)
//
//
//
//
try {
$username = 'ram8ny';
$password = 'Spring2021!!';
$dbname = 'ram8ny';
$host = "usersrv01.cs.virginia.edu";
$dsn = "mysql:host=$host;dbname=$dbname";
$db = new PDO($dsn, $username, $password);
} catch (PDOException $e) {
$error_message = $e->getMessage();
echo "<p>An error occurred while connecting to the database: $error_message </p>";
} catch (Exception $e) {
$error_message = $e->getMessage();
echo "<p>Error Message: $error_message </p>";
}
//?>