我不断收到此错误:
Query1 失败:您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 1 行的“d41d8cd98f00b204e9800998ecf8427e”“d41d8cd98f00b204e9800998ecf8427e”、“d41d8cd”附近使用正确的语法
这是我正在使用的代码:
<?php
$payment = $_GET['payment'];
if($payment){
include("connection.php");
$CardHolder = md5($_POST["CardHolder"]);
$CardType = md5($_POST["CardType"]);
$CardNumber = md5($_POST["CardNumber"]);
$SecurityCode = md5($_POST["SecurityCode"]);
$ExpiryDate = md5($_POST["ExpiryDate"]);
$PurchaseID = $_SESSION['purchaseid'];
$Email = $_SESSION['user'];
$sql = "INSERT INTO Payment (CardHolder, CardType, CardNumber, SecurityCode, ExpiryDate, PurchaseID, Email) VALUES (\"$CardHolder\", \"$CardType\", , \"$CardNumber\" \"$SecurityCode\", \"$ExpiryDate\", \"$PurchaseID\", \"$Email\")";
$result = mysqli_query($con, $sql) or die('Query1 failed: ' . mysqli_error($con));;
if($result){
echo "<p>Your Payment has been Accepted. You are now being redirected to the to the HomePage.</p>
<meta http-equiv=\"refresh\" content=\"1;URL=index.php\" />";
} else {
echo "<p>Payment Failed, Please try again later.</p>";
}
}
?>
我不确定我做错了什么。提前感谢您的支持。
编辑:使用提供的答案后,我现在收到此错误 Query1 失败:列数与第 1 行的值计数不匹配。只是为了让你们知道我有一个 PaymentID,即 Auto INCREMENT。