php jede menge

This commit is contained in:
Peter Hoppe
2022-12-16 15:54:13 +01:00
parent accf248e3c
commit 147fd66fff
10 changed files with 437 additions and 116 deletions

View File

@ -1,5 +1,6 @@
<?php
class Database{
class Database
{
// CHANGE THE DB INFO ACCORDING TO YOUR DATABASE
private $db_host = 'localhost';
@ -10,12 +11,14 @@ class Database{
public function dbConnection(){
try{
try
{
$conn = new PDO('mysql:host='.$this->db_host.';dbname='.$this->db_name,$this->db_username,$this->db_password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $conn;
}
catch(PDOException $e){
catch(PDOException $e)
{
echo "Connection error ".$e->getMessage();
exit;
}