2
Ich habe ein Problem mit einer Funktion, sollte Funktion einen Text Basis (phpMyAdmin) oder Menüanzeigen Fehler ..kann nicht null sein - PhP PDO Funktion
Fehlercode gesendet werden:
Error: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'Code' cannot be null
Meine Funktion:
public function UploadInvoice($CONN)
{
$SubmitOK = '1';
$Core = new Core();
$Core->CheckForEmpty(array('Code'), 'finances.php');
if($SubmitOK == '1') {
try {
$SQL = 'INSERT INTO Invoices (UserID, Code) VALUES (:UserID, :Code)';
$SQL = $CONN->prepare($SQL);
$SQL->execute(array('UserID' => $_SESSION['UserLogin']['ID'], 'Code' => $Code));
$_SESSION['Success'] = 'Successfully submitted your code, Wait for checking multiple payments, your money will be soon on the bill';
header('location: finances');
exit();
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
} else {
$_SESSION['Error'] = 'An error has occurred. Try again!';
header('location: finances');
exit();
}
}
Meine Form Code:
<form action="" method="POST">
<input type="text" class="form-control" required="true" minlength="4" name="Code" placeholder="Your ID">
<button type="submit">SEND</button>
</form>
Der Fehler eindeutig fest, dass '$ Code' keinen Wert haben –
HALLO @CyberFX: Sie didn‘ t Reagieren Sie auf die unten angegebene Antwort. –