-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.env.php
More file actions
24 lines (21 loc) · 710 Bytes
/
Copy path.env.php
File metadata and controls
24 lines (21 loc) · 710 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
<?php
// Database configuration, set with your own details
define('DB_HOST', 'localhost');
define('DB_USER', 'booking');
define('DB_PASSWORD', 'booking');
define('DB_NAME', 'booking');
// Establish database connection with error handling
$conn = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
// Function to escape user input for SQL query with additional checks
function escapeString($conn, $value) {
if ($conn && is_object($conn) && property_exists($conn, 'server_info')) {
return mysqli_real_escape_string($conn, $value);
} else {
die("Invalid database connection");
}
}
?>