-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.php
31 lines (28 loc) · 1.01 KB
/
config.php
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
// Adatbázis bejelentkezési adatok
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');
define('DB_NAME', 'main');
// Csatlakozás MySQL-re
$link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
mysqli_set_charset($link, "utf8");
// Csatlakozás ellenőrzése
if ($link === false) {
die("ERROR: Could not connect. " . mysqli_connect_error());
}
function pdo_connect_mysql()
{
// Update the details below with your MySQL details
$DATABASE_HOST = 'localhost';
$DATABASE_USER = 'root';
$DATABASE_PASS = '';
$DATABASE_NAME = 'main';
try {
return new PDO('mysql:host=' . $DATABASE_HOST . ';dbname=' . $DATABASE_NAME . ';charset=utf8', $DATABASE_USER, $DATABASE_PASS);
} catch (PDOException $exception) {
// If there is an error with the connection, stop the script and display the error.
exit('Failed to connect to database!');
}
}
$num_items_in_cart = isset($_SESSION['cart']) ? count($_SESSION['cart']) : 0;