2
我有個問題與一種功能,功能應當文本發送到基座(phpmyadmin的),或菜單顯示錯誤..不能爲空 - 比索PDO功能
錯誤代碼:
Error: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'Code' cannot be null
我的功能:
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();
}
}
我的表單代碼:
<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>
錯誤中明確指出'$ Code'沒有任何價值 –
HI @CyberFX:你沒」 t迴應下面給出的答案。 –