PHP Mysql PDO number of bound variables does not match number of tokens(PHP Mysql PDO 绑定变量数量与令牌数量不匹配)
本文介绍了PHP Mysql PDO 绑定变量数量与令牌数量不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我环顾四周,但似乎无法找到我的问题的答案.
这是我第一次使用 PDO,所以我完全是新手.
我将大量数据拆分为 2 个表并希望将它们合并为一个,还有其他方法可以做到这一点,但没有深入探讨为什么我要这样做的复杂原因...>
我生成了我想从中复制数据的表的记录集
构建我的语句
循环运行
但我收到以下错误
SQLSTATE[HY093]: Invalid parameter number: number of bound variables not match of tokens
我已经通过并三重检查了我有相同数量的变量,所以为什么令牌不匹配我不知道"就像我说的那样对此很陌生,所以可能错过了专业人士认为显而易见的东西.
可能值得一提的是,我没有添加到表中的每一列,还有其他列,但我已将它们排除在准备好的语句之外...这是我的代码:
//$dbh = new PDO($hostname_Seriously, $DB_USER, $DB_PASSWORD);$dbh = new PDO('mysql:host=localhost;dbname=seriouslysoulful_summers', $username_Seriously, $password_Seriously);$stmt = $dbh->prepare("INSERT INTO records_rec (oldid_rec, firstname_rec,artist_rec,side_rec,bside_rec,label_rec,condition_rec,genere_rec,price_rec,collection_rec,active_rec,info_rec,notes_rec,order_rec,alabelimage_rec,asound_rec_rec,b、featured_rec、format_rec)VALUES (:oldid_rec, :firstname_rec, :artist_rec, :aside_rec, :bside_rec, :label_rec, :condition_rec, :genere_rec, :price_rec, :collection_rec, :active_rec, :info_rec, :notes_rec, :order_image_rec_recasound_rec, bsound_rec, :featured_rec, :format_rec)");$stmt->bindParam(':oldid_rec', $id);$stmt->bindParam(':firstname_rec', $firstname);$stmt->bindParam(':artist_rec', $artist);$stmt->bindParam(':aside_rec',$aside);$stmt->bindParam(':bside_rec',$bside);$stmt->bindParam(':label_rec',$label);$stmt->bindParam(':condition_rec',$condition);$stmt->bindParam(':genere_rec',$genere);$stmt->bindParam(':price_rec',$price);$stmt->bindParam(':collection_rec',$collection);$stmt->bindParam(':active_rec',$active);$stmt->bindParam(':info_rec',$info);$stmt->bindParam(':notes_rec',$notes);$stmt->bindParam(':order_rec',$order);$stmt->bindParam(':alabelimage_rec',$alabel);$stmt->bindParam(':blabelimage_rec',$blabel);$stmt->bindParam(':asound_rec',$asound);$stmt->bindParam(':bsound_rec',$bsound);$stmt->bindParam(':featured_rec',$featured);$stmt->bindParam(':format_rec',$format);$reccount = 0;//做{$id = $row_rs_original['id_prod'];$名字=mysql_real_escape_string($row_rs_original['firstname_prod']);$artist = mysql_real_escape_string($row_rs_original['artist_prod']);$aside = mysql_real_escape_string($row_rs_original['a_side_prod']);$bside = mysql_real_escape_string($row_rs_original['b_side_prod']);$label = mysql_real_escape_string($row_rs_original['label_prod']);$condition = mysql_real_escape_string($row_rs_original['condition_prod']);$genere = $row_rs_original['genre_prod'];$price = $row_rs_original['price_prod'];$collection = mysql_real_escape_string($row_rs_original['collection_prod']);$active = $row_rs_original['active_prod'];$info = mysql_real_escape_string($row_rs_original['info_prod']);$notes = mysql_real_escape_string($row_rs_original['notes_prod']);$order = $row_rs_original['order_prod'];$alabel = mysql_real_escape_string($row_rs_original['labelimage_A_prod']);$blabel = mysql_real_escape_string($row_rs_original['labelimage_B_prod']);$asound = mysql_real_escape_string($row_rs_original['soundfile_A_prod']);$bsound = mysql_real_escape_string($row_rs_original['soundfile_B_prod']);$featured = $row_rs_original['featured_prod'];$format = $row_rs_original['format_prod'];$stmt->execute();$reccount = $reccount +1;/
沃梦达教程
本文标题为:PHP Mysql PDO 绑定变量数量与令牌数量不匹配
基础教程推荐
猜你喜欢
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- 使用 PDO 转义列名 2021-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- HTTP 与 FTP 上传 2021-01-01
- PHP 守护进程/worker 环境 2022-01-01