我想从普通的mysql查询更改为PDO,但从那时起我甚至无法追溯故障。php提交PDO SQL问题
有没有人帮助我?任何提示将不胜感激!
问题1:有什么问题? Q2:一般如何追踪故障?
<?php
// Check if add button active, start this
if (isset($_POST['create'])) {
$new=htmlspecialchars($_POST['newgroup']);
$sql = "INSERT INTO contactgroups (status, gr_name) VALUES(1, : new)";
$sql->bindvalue(': new', $new);
$sql->execute();
$arr = $sql->errorInfo();
echo $arr;
echo "<meta http-equiv=\"refresh\" content=\"0;URL=groups.php\">";
}
?>
<form id="group-in" method="post" action="groups.php">
Add new Distribution group: <input type="text" name="newgroup" placeholder="name..."> <input type="submit" name="create" value="Create new">
Rename groupname: <input type="text" value="<?php echo $result['gr_name']; ?>"> <input type="submit" name="rename" value="Rename">
</form>
的$ _ POST快到了,SQL正在运行,但bindPARAM/bindVALUE没有东西后...
+1 @JürgenThelen:那是另一个错!非常感谢。 –