Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''1235'='1235' WHERE username='wafflezzz'' at line 1' in /home/wafflez3/public_html/Project SA Theme/ipn/set.php:14 Stack trace: #0 /home/wafflez3/public_html/Project SA Theme/ipn/set.php(14): PDOStatement->execute() #1 {main} thrown in /home/wafflez3/public_html/Project SA Theme/ipn/set.php on line 14錯誤:SQLSTATE [42000]當我嘗試更新表中的值時
當我使用此代碼將空值更改爲值時,出現該錯誤。
<?php session_start(); require "../pdo_connect.php"; $usrname = $_SESSION["username"]; ?>
<title>Loading...</title>
<?php
$checker = $conn->prepare("SELECT * FROM transactions WHERE payer_user=:username AND success='1'");
$checker->bindParam(":username", $usrname);
$checker->execute();
while ($row = $checker->fetch(PDO::FETCH_BOTH)) {
$paidscript = $row["item_name"];
$sql = $conn->prepare("UPDATE us SET :script=:script WHERE username=:userr");
$sql->bindParam(":userr", $usrname);
$sql->bindParam(":script", $paidscript);
$sql->execute();
echo "You can now view the script!";
}
你確定它並不意味着是'$ SQL = $ conn->準備(「更新我們將腳本=:腳本其中username = :userr「);'? – Matt
這一行$ sql = $ conn-> prepare(「UPDATE us SET:script =:script WHERE username =:userr」);從腳本列名稱中刪除':' –
其:腳本,因爲我想獲取腳本名,如果你將腳本名設置爲腳本名,我的系統就可以工作,那麼你需要腳本。這是我的愚蠢,但那就是我是如何做到的。此外,腳本名獲得一列 – Ch33ky