Data base
parent
66ab4929f4
commit
58b52438a8
|
@ -1,15 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
$db_link = mysqli_connect('141.19.142.11', 'web_b-3', 'een7Ao6s', 'bibliothek_candle');
|
|
||||||
|
|
||||||
if(!$db_link){
|
$servername = "141.19.142.11";
|
||||||
die("<p>Verbindung nicht hergestellt</p>");
|
$username = "web_b-3";
|
||||||
}else{
|
$password = "een7Ao6s";
|
||||||
echo "Verbindung hergestellt!";
|
$database = "bibliothek_candle";
|
||||||
}
|
|
||||||
|
try {
|
||||||
|
$conn = new PDO("mysql:host=$servername;dbname=$database", $username, $password);
|
||||||
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
echo "Connected successfully";
|
||||||
|
} catch(PDOException $e) {
|
||||||
|
echo "Connection failed: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function runSQL($sql){
|
|
||||||
global $db_link;
|
|
||||||
$db_res = mysqli_query($db_link, $sql) or die("SQL_Abfrage: " . $sql . "Fehler: " . mysqli_error($db_link));
|
|
||||||
return $db_res;
|
|
||||||
}
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue