config.php
Gesponsorde koppelingen
PHP script bestanden
Code (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
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
<?php
Database gegevens voor connectie
define("HOST", 'localhost');
define("NAME", 'login');
define("PASS", '');
define("USER", 'root');
class Connect{
public static function connect(){
try{
$opts = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
return new PDO('mysql:host=' . HOST .';dbname=' . NAME . ';charset=utf8', USER, PASS, $opts);
}
catch(PDOException $e){
//throw new PDOException($e->getMessage(), (int)$e->getCode());
return 'Something get wrong!';
}
}
}
?>
Database gegevens voor connectie
define("HOST", 'localhost');
define("NAME", 'login');
define("PASS", '');
define("USER", 'root');
class Connect{
public static function connect(){
try{
$opts = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
return new PDO('mysql:host=' . HOST .';dbname=' . NAME . ';charset=utf8', USER, PASS, $opts);
}
catch(PDOException $e){
//throw new PDOException($e->getMessage(), (int)$e->getCode());
return 'Something get wrong!';
}
}
}
?>