[英]Why am I receiving HY093 error [PDO]
here is my function: 这是我的功能:
function create($printing_id,$Machine,$Started,$Grams,$color) {
//*
$this->sql = "insert into `".$this->tableName."` (`3dprinting_id`,`Machine`,`Started`,`Grams`,`color`) values ( :3dprinting_id , :Machine, :Started , :Grams , :color )";
$this->stmt = $this->dbh->prepare($this->sql);
$this->stmt->bindParam(":3dPrinting_id",$printing_id,PDO::PARAM_INT);
$this->stmt->bindParam(":Machine",$Machine,PDO::PARAM_STR);
$this->stmt->bindParam(":Started",$Started,PDO::PARAM_STR);
$this->stmt->bindParam(":Grams",$Grams,PDO::PARAM_INT);
$this->stmt->bindParam(":color",$color,PDO::PARAM_STR);
$this->params = array();
$this->params[":3dPrinting_id"] = $printing_id;
$this->params[":Machine"] = $Machine;
$this->params[":Started"] = $Started;
$this->params[":Grams"] = $Grams;
$this->params[":color"] = $color;
return $this->stmt->execute();
//*/
/*
$this->sql = "insert into `".$this->tableName."` (`3dprinting_id`,`Machine`,`Started`,`Grams`,`color`) values ($printing_id,'$Machine','$Started',$Grams,'$color')";
return $this->dbh->exec($this->sql);
//*/
}
When I do it the top way (not commented out) I get an HY093 error. 当我这么做的时候(没有注释掉)我得到了一个HY093错误。 When I do it the bottom way it works perfectly.
当我这样做时,它的底部方式完美无缺。
In my database: 在我的数据库中:
Just like variables, binds are case-sensitive. 就像变量一样,绑定区分大小写。
You have this in your values ( :3dprinting_id
你有这个值
( :3dprinting_id
and then you're doing 然后你正在做
bindParam(":3dPrinting_id"
They need to match in letter-case. 他们需要在信件中匹配。
bindParam(":3dprinting_id"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.