我正在尝试使准备好的语句起作用,但出现相同的错误。它说我正在尝试在需要mysql_stmt的地方使用布尔值。
if ($_SERVER['REQUEST_METHOD']=='POST')
{
{
require('zzzx.php') ;
$quer = 'insert into bloggert (message,email,date) values (?,?,now()) ';
$stmt= mysqli_prepare($conn,$quer);
mysqli_stmt_bind_param($stmt,'ss',$email,$message);
// this is where the errors start. It always ways says it is getting a
// boolean rather than a mysql statement which is required
$message= nl2br(strip_tags ($_POST['message']));
$auathor = strip_tags($_POST['email']);
mysqli_stmt_execute($stmt);
if (mysqli_stmt_affected_rows($stmt)==1)
{
echo '<p> the review made it to posting</p>';
}
else
{
echo '<p style = "font-weight:bold; color:#c00;"> It failed utterly.</p>';
//this, needless to say is what I got with ever reiteration
echo '<p>'.mysqli_stmt_error($stmt).' </p>' ;
}
mysqli_stmt_close($stmt);
mysqli_close($conn);
}
}
问题是,我将其复制到另一个可以正常工作的文件,没问题。
此外,我注意到其他人正在使用不同的分配方式。那会成为我问题的根源吗?