Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.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
可捕获的致命错误:类PDOStatement的对象无法转换为第40行D:\wamp64\www\blog\modal\CommentManager.php中的字符串_Php - Fatal编程技术网

可捕获的致命错误:类PDOStatement的对象无法转换为第40行D:\wamp64\www\blog\modal\CommentManager.php中的字符串

可捕获的致命错误:类PDOStatement的对象无法转换为第40行D:\wamp64\www\blog\modal\CommentManager.php中的字符串,php,Php,更新不起作用:此代码在execute()中给了我一个错误: 可捕获的致命错误:类PDOStatement的对象无法转换为第40行D:\wamp64\www\blog\modal\CommentManager.php中的字符串 将$comment用作PDOStatement的变量,并再次用作第一个输入参数的值 将(数组($comment,$idComment)更改为(数组($textcoment,$idComment): 您使用$comment作为PDOStatement的变量,并再次作为第一个输

更新不起作用:此代码在
execute()
中给了我一个错误:

可捕获的致命错误:类PDOStatement的对象无法转换为第40行D:\wamp64\www\blog\modal\CommentManager.php中的字符串


$comment
用作
PDOStatement
的变量,并再次用作第一个输入参数的值

(数组($comment,$idComment)
更改为
(数组($textcoment,$idComment)


您使用
$comment
作为
PDOStatement
的变量,并再次作为第一个输入参数的值

(数组($comment,$idComment)
更改为
(数组($textcoment,$idComment)



您想返回
$comment->fetch()
,而不是
$comment
您想返回
$comment->fetch()
,而不是
$comment
谢谢Zhorov您是对的,我没有注意这个细节谢谢Zhorov您是对的,我没有注意这个细节
$bdd=$this->dbConnect();
$comment=$bdd->prepare('UPDATE commentaires SET commentaire=? WHERE id=? ');
$comment->execute(array($comment,$idComment));
$comment->fetch();
return $comment;
<?php
$bdd = $this->dbConnect();
$comment = $bdd->prepare('UPDATE commentaires SET commentaire=? WHERE id=? ');
$comment->execute(array($textComment, $idComment));
$comment->fetch();
return $comment;
?>