Created
December 17, 2021 17:43
-
-
Save CuzImBisonratte/f69705db983df5df5262f8befd7acaf5 to your computer and use it in GitHub Desktop.
This file contains 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 | |
// Database credentials | |
$DATABASE_HOST = ''; | |
$DATABASE_USER = ''; | |
$DATABASE_PASS = ''; | |
$DATABASE_NAME = ''; | |
$DATABASE_TABLE = ''; | |
// Connect with the Credentials | |
$con = mysqli_connect($DATABASE_HOST, $DATABASE_USER, $DATABASE_PASS, $DATABASE_NAME); | |
// check if the connection was successfull | |
if (mysqli_connect_errno()) { | |
// Log the error | |
error_log("Error(101)-".mysqli_connect_error(),0); | |
exit("Error(101)-".mysqli_connect_error()); | |
// Display an error. | |
exit(); | |
} | |
if ($stmt = $con->prepare('INSERT INTO '.$DATABASE_TABLE.' (wert1, wert2, wert3, wert4) VALUES (?, ?, ?, ?)')) { | |
// Get the data | |
$wert1 = $_POST['wert1']; | |
$wert2 = $_POST['wert2']; | |
$wert3 = $_POST['wert3']; | |
$wert4 = $_POST['wert4']; | |
$stmt->bind_param('ssss', $wert1, $wert2, $wert3, $wert4); | |
$stmt->execute(); | |
exit(); | |
// close the statement | |
$stmt->close(); | |
} else { | |
// Log the error | |
exit("Error-".mysqli_error($con)); | |
} | |
// close the database connection | |
$con->close(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment