LBT3: begin project
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
# Zweites Jahr
|
||||
|
||||
|
||||
## Infos
|
||||
|
||||
Wichtige Informationen
|
||||
|
||||
- Wir eventuell nie aktuell sein.
|
||||
- Stundenplan - [Link](https://wvss-mannheim.webuntis.com/WebUntis?school=wvss-mannheim#/basic/timetablePublic/class?date=2025-12-08&entityId=2583)
|
||||
|
||||
## 10-12-25 - PHP
|
||||
|
||||
- Unterrichtsprojekt begonnen:
|
||||
- Verbindung zur Datenbank
|
||||
|
||||
## 9-12-25 - PHP (SQL)
|
||||
|
||||
- Datenbank durch PHP erstellt und Daten hinzufügen
|
||||
@@ -24,7 +30,6 @@ Wichtige Informationen
|
||||
|
||||
- Übung Datei lesen/schreiben (Log Access)
|
||||
|
||||
|
||||
### 18-11-25 - PHP
|
||||
|
||||
- Datein lesen
|
||||
|
||||
9
Zweites Jahr/unterrichts_projekt/db_connection_data.php
Normal file
9
Zweites Jahr/unterrichts_projekt/db_connection_data.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
// db_connection_data.php
|
||||
|
||||
|
||||
$db_engine ="mysql";
|
||||
$db_name = "E2FI1_2025";
|
||||
$db_host = "localhost";
|
||||
$db_user = "phpmyadmin";
|
||||
$db_password = "server";
|
||||
20
Zweites Jahr/unterrichts_projekt/db_connection_function.php
Normal file
20
Zweites Jahr/unterrichts_projekt/db_connection_function.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// db_connection_function.php
|
||||
|
||||
function db_connect(){
|
||||
require_once("db_connection_data.php");
|
||||
// db_server = "mysql:dbname=testdb;host:localhost";
|
||||
$db_server = "$db_engine:dbname=$db_name;host=$db_host";
|
||||
try {
|
||||
$dbh = new PDO ($db_server, $db_user, $db_password);
|
||||
echo "<p>DB Connection succesfull established!</p>";
|
||||
return $dbh;
|
||||
} catch (PDOException $e){
|
||||
echo "Could not connect to DB!<br> ";
|
||||
die("More:".$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Test:
|
||||
db_connect();
|
||||
Reference in New Issue
Block a user