47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
$servername = "localhost";
|
|
$username = "web_b-3";
|
|
$password = "een7Ao6s";
|
|
$dbname = "bibliothek_candle";
|
|
|
|
// Create a connection
|
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
|
|
// Check the connection
|
|
if ($conn->connect_error) {
|
|
die("Connection failed: " . $conn->connect_error);
|
|
}
|
|
|
|
|
|
// Assume you have a table named 'users' with columns 'name' and 'email'
|
|
|
|
$vorname = $_POST["vorName"];
|
|
$nachname = $_POST['nachName'];
|
|
$strasse = $_POST['strasse'];
|
|
$hausnummer = $_POST['hausnummer'];
|
|
$plz = $_POST['postleitzahl'];
|
|
$ort = $_POST['ort'];
|
|
$email = $_POST['email'];
|
|
$passwort = $_POST['passwort'];
|
|
$kartenid = 1;
|
|
$id = 1;
|
|
// Prepare the INSERT statement
|
|
$stmt = $conn->prepare("INSERT INTO benutzer (VorName, NachName, KartenID, E-MailAdresse,AdressenID, Passwort) VALUES ('". $vorname ."' , '". $nachname ."' ,'". $kartenid ."' , '". $email ."', '". $id ."','". $passwort ."')");
|
|
|
|
// Execute the statement
|
|
if ($stmt->execute()) {
|
|
echo "Data inserted successfully.";
|
|
} else {
|
|
echo "Error inserting data: " . $stmt->error;
|
|
}
|
|
|
|
// Close the statement and connection
|
|
$stmt->close();
|
|
$conn->close();
|
|
|
|
|
|
|
|
|
|
|
|
?>
|