-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.php
More file actions
31 lines (26 loc) · 1023 Bytes
/
config.php
File metadata and controls
31 lines (26 loc) · 1023 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
<?php
/*
* config.php
* This file contains the database configuration and connection logic.
* It's included in other files to access the database.
*/
// --- Database Credentials ---
// Replace with your actual database credentials.
$servername = "localhost"; // Usually "localhost" for local development
$username = "root"; // Default username for XAMPP/WAMP is "root"
$password = ""; // Default password for XAMPP/WAMP is empty
$dbname = "ds_diamonds_db"; // The database name you created
// --- Create connection ---
$conn = new mysqli($servername, $username, $password, $dbname);
// --- Check connection ---
if ($conn->connect_error) {
// If connection fails, stop the script and display an error.
die("Connection failed: " . $conn->connect_error);
}
// Optional: Set character set to utf8mb4 for better character support.
$conn->set_charset("utf8mb4");
// Start the session. This is needed for login functionality.
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
?>