2015-04-16 19 views
5

burada fonksiyonudur: ben o üst yol yaptığınızdaNeden aldıktan duyuyorum HY093 hatası [PDO]

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); 
     //*/ 
    } 

(diye değil) Bir HY093 hata alıyorum. Bunu yaptığım zaman en iyi şekilde çalışır. Benim veritabanında

:

  • 3dprinting_id bir int,
  • gram olan null olamaz,
  • Başlatılan
  • datetime olan
  • Makine varchar (30), boş olabiliyor boş olamaz int,
  • renk varchar (30), boş olabilir olan boş olabilir

cevap

8

Değişkenler gibi, bağlamalar büyük/küçük harfe duyarlıdır.

Ardından Onlar harf durumunda eşleşmesi gerekir

bindParam(":3dPrinting_id" 

yapıyoruz değerlerinizin (:3dprinting_id

ve bu var.

bindParam(":3dprinting_id" 
+0

Bunu olabildiğince çabuk kabul eder. Diğer sorularda bahsedilen bu tür bir problemi bile gördüm ve anlayamadım. – cdm014

+0

@ cdm014 Daha önce aynı hatayı yaptım ve diğer birçok kişinin de orada olduğundan eminim, * şerefe * –

İlgili konular