我有一个简单的SQL语句,我在这里绑定变量并且它没有绑定。这些值在更新语句中对它们进行硬编码时起作用,但在绑定它们时不起作用:
if(isset($_GET["coachUpdate"])) {
if ($pdoLink = \Database::GetInstance()->GetPDO()) {
$updateQuerySQL = "UPDATE Registration SET Coach = :coach WHERE Reg = :reg";
if ($updateQuery = $pdoLink->prepare($updateQuerySQL)) {
$bindValues = "";
$bindValues[":reg"] = $_GET["Reg"];
$bindValues[":coach"] = $_GET["Coach"];
if ($updateQuery->execute($bindValues)) {
if ($query->rowCount()) {
echo $updateQuerySQL;
}
}
} else {
echo "Registration update query prep failed.<br />";
}
}
}