Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php SQL:绑定变量的数量_Php_Sql_Database_Spaces - Fatal编程技术网

Php SQL:绑定变量的数量

Php SQL:绑定变量的数量,php,sql,database,spaces,Php,Sql,Database,Spaces,我在这里读了一些主题,但我没有找到正确的答案 我得到这个错误: Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in .... PHP代码: $sarray[':item1'.$i] = $ws->getCell($item

我在这里读了一些主题,但我没有找到正确的答案

我得到这个错误:

Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid
parameter number: number of bound variables does not match number of tokens in
....
PHP代码:

$sarray[':item1'.$i] = $ws->getCell($item1.$i)->getValue();
$sarray[':item2'.$i] = $ws->getCell($item2.$i)->getValue();
$sarray[':item3'.$i] = $ws->getCell($item3.$i)->getValue();

$sql = update ...

$sql1 = $DB->prepare($sql);    

$sql1->execute($sarray);
在执行之后,我得到一个错误(它在顶部)

问题:

问题是,$sarray[':item1'.$i]$sarray[':item2'.$i]具有相同的定义,如果添加第三个$sarray[':item3'.$i]它会出错,但我不知道如何修复它


感谢您的回复。

您能分享您
准备的查询吗
d?我从xlsx文档中获取值,一切正常,但当例如$sarray[':item3'$I]=123 45时,它会出错,我想这是因为缺少空格和撇号。抱歉,它不是空格。。。我现在把没有空格的代码和相同的。。。故障在哪里