PDO和更新无法正常工作

用户3851186

我正在使用pdo php mysql和我正在使用以下脚本进行更新

$pdo = new PDO('mysql:host=79.170.44.155;dbname=cl36-nedal', 'cl36-nedal', 'wC-X.zfUb'); 
$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );


 $statement = $pdo->prepare("update annonce set id_compte= :id_compte , mod=:date_annonce, type= :type , section= :section ,
 vac =:vac , bien =:bien , ville=:ville , prix =:prix,sup_glob=:sup_glob , sup_hab=:sup_hab,nbr_chambre=:nbr_chambre,bains=:bains,
 etage_app=:etage_app,annee_const:=annee_const,jardin=:jardin,garage=:garage,terrasse=:terrasse,ascenseur=:ascenseur,gardiannage=:gardiannage,
 communication=:communication,securite=:securite,balcon=:balcon,picine=:picine,chem=:chem,clima=:clima,sansvi=:sansvi,park_vis=:park_vis,
 ter_imm=:ter_imm,info=:info,photo1=:p,photo2=:p1,photo3=:p2,photo4=:p3 where id_annonce =:annonce");


$statement->bindValue(':annonce',$hid);

$statement->bindValue(':id_compte',$id);
$statement->bindValue(':date_annonce',$date);
$statement->bindValue(':type',$type);
$statement->bindValue(':section',$section);
$statement->bindValue(':vac',$vac);
$statement->bindValue(':bien',$_POST['biens']);
$statement->bindValue(':ville',$_POST['villes']);
$statement->bindValue(':prix',$prix);
$statement->bindValue(':sup_glob',$sg);
$statement->bindValue(':sup_hab',$sh);
$statement->bindValue(':nbr_chambre',$nbc);
$statement->bindValue(':bains',$nbs);
$statement->bindValue(':etage_app',$etage);
$statement->bindValue(':annee_const',$annee);
$statement->bindValue(':jardin',$jardin);
$statement->bindValue(':garage',$garage);
$statement->bindValue(':terrasse',$terrase);
$statement->bindValue(':ascenseur',$ascenseur);
$statement->bindValue(':gardiannage',$gardiennage);
$statement->bindValue(':communication',$communication);
$statement->bindValue(':securite',$ss);
$statement->bindValue(':picine',$piscine);
$statement->bindValue(':balcon',$balcon);
$statement->bindValue(':chem',$cham);
$statement->bindValue(':clima',$clim);
$statement->bindValue(':sansvi',$vav);
$statement->bindValue(':park_vis',$pv);
$statement->bindValue(':ter_imm',$ti);
$statement->bindValue(':info',$info);   
$statement->bindValue(':p',$tableau[0]);
$statement->bindValue(':p1',$tableau[1]);
$statement->bindValue(':p2',$tableau[2]);
$statement->bindValue(':p3',$tableau[3]);


$statement->execute();

问题是我得到了这个答案

异常->字符串(100)“ SQLSTATE [HY093]:无效的参数编号:绑定变量的数量与令牌的数量不匹配”

请问是什么问题。

马克·B

在查询中输入错字:

  [...snip...] annee_const:=annee_const  [...snip...]
                          ^^---

您已将:换位=因此没有:annee_const参数,因此是您的错误。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

使用PDO更新mysql无法正常工作

来自分类Dev

更新在PHP中使用PDO无法正常工作

来自分类Dev

PDO bindParam无法正常工作

来自分类Dev

更新无法正常工作

来自分类Dev

使用MongoClient更新无法正常工作的NodeJ和MongoDB

来自分类Dev

Android-SQLite删除和更新数据无法正常工作

来自分类Dev

PDO dblib nextRowset无法正常工作

来自分类Dev

PDO / SQL插入无法正常工作

来自分类Dev

PHP PDO登录系统无法正常工作

来自分类Dev

PDO中的LIKE查询无法正常工作

来自分类Dev

PHP中的PDO无法正常工作

来自分类Dev

PDO dblib nextRowset无法正常工作

来自分类Dev

Mysqli更新无法正常工作

来自分类Dev

更新后ServiceBusTrigger无法正常工作

来自分类Dev

更新文件无法正常工作

来自分类Dev

余烬更新后LinkTo无法正常工作

来自分类Dev

Netflix桌面在更新后无法正常工作

来自分类Dev

通过PHP的MySQL更新无法正常工作

来自分类Dev

NetBeans更新后无法正常工作

来自分类Dev

Xubuntu软件更新无法正常工作?

来自分类Dev

表单提交的Firebase更新无法正常工作?

来自分类Dev

NetBeans更新后无法正常工作

来自分类Dev

使用concat的MySQL更新无法正常工作

来自分类Dev

更新记录ajax jQuery无法正常工作

来自分类Dev

软件更新程序无法正常工作

来自分类Dev

余烬更新后LinkTo无法正常工作

来自分类Dev

Windows 10“ ipconfig /更新”无法正常工作

来自分类Dev

更新CoreData对象无法正常工作

来自分类Dev

Eclipse更新后无法正常工作