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
I get that error when I use this code to change a null value to a value.
<?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!";
}