我猜我错过了一些东西,但我似乎无法让这个声明发挥作用。当我将其加载到页面中时,我得到了死机白屏。
这是我想要运行的内容
$statement = $db-> prepare("INSERT INTO `simplyaccomplished`.`blog_comment` (`ID`, `comment`, `date`, `ip_address`, `valid`, `name`, `blogcomment_ID`) VALUES (NULL, ?, NOW(), ?, 0, ?, ? );");
$statement -> bind_param("sssi",$comment, $ipaddress, $name , $comment_id);
$statement -> execute($statement);
$statement -> close();
奇怪的是它运行得很好
$query = ("INSERT INTO `simplyaccomplished`.`blog_comment` (`ID`, `comment`, `date`, `ip_address`, `valid`, `name`, `blogcomment_ID`) VALUES (NULL,'$comment' , NOW(), '$ipaddress', '0', '$name', '$comment_id');");
$result =$db->query($query);
如果有人能告诉我哪里出了问题,我将不胜感激!
最佳答案
您要查找的 PDO 方法名为 bindParam
,而不是 bind_param
:)
关于php 准备好的语句失败。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7844863/