可捕获的致命错误:类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;
?>