This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Whatever\Whatever | |
| use PDO; | |
| class XxxRepository | |
| { | |
| private $pdo; | |
| public function __construct(PDO $pdo) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * An example of a project-specific implementation. | |
| * | |
| * After registering this autoload function with SPL, the following line | |
| * would cause the function to attempt to load the \Foo\Bar\Baz\Qux class | |
| * from /path/to/project/src/Baz/Qux.php: | |
| * | |
| * new \Foo\Bar\Baz\Qux; | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function something($title){ | |
| global $pdo; | |
| $stmt=$pdo->prepare("SELECT * FROM 'spaltenname' WHERE title=:title"); | |
| $stmt->execute(['title'=>$title]); | |
| return $stmt->fetch(); | |
| } | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $dsn = 'mysql:dbname=lernschlau;host=localhost'; | |
| $user = 'root'; | |
| $password = 'root'; | |
| try { | |
| $dbh = new PDO($dsn, $user, $password); | |
| $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
| } catch (PDOException $e) { | |
| echo 'Verbindung fehlgeschlagen: ' . $e->getMessage(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function autoload($className) | |
| { | |
| $className = str_replace("\\","/",$className); | |
| if (file_exist("./scr/{$className}.php")){ | |
| require "./scr/{$className}.php"; | |
| } | |
| } | |
| spl_autoload_register("autoload"); | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function formular_erstellen ($emailadresse = "", | |
| $gender="", | |
| $vorname="", | |
| $nachname="", | |
| $einverstanden="" ) | |
| { | |
| echo '<form name="" action="'; | |
| echo $_SERVER['PHP_SELF']; | |
| echo '" method="GET" enctype="text/html">'; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $mailtext='<html> | |
| <head> | |
| <titel>Titel der E-Mail</titel> | |
| </head> | |
| <body> | |
| <h1> Diese E-Mail wurde mit php erstellt</h1> | |
| <p>Text der E-Mail</p> | |
| </html> | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| DEFINE('DB_USERNAME', 'root'); | |
| DEFINE('DB_PASSWORD', 'root'); | |
| DEFINE('DB_HOST', 'localhost'); | |
| DEFINE('DB_DATABASE', 'performance_schema'); | |
| $mysqli = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE); | |
| if (mysqli_connect_error()) { | |
| die('Connect Error ('.mysqli_connect_errno().') '.mysqli_connect_error()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $empfaenger ="du@domain.de"; | |
| $absender = "ich@domain.de"; | |
| $betreff ="PHP- Testmail"; | |
| $mailtest ="Inhalt der E-Mail"; | |
| $antwortan ="ich@domain.de"; | |
| mail($empfanger,$betreff,$mailtext,"From: $absender\nReply-To.: $antwortan"); | |
| echo "Mail wurde gesendet!"; | |
| ?> |