当我在machine a
上使用mysqli运行以下代码时,执行查询和查看数据没有问题。但是在machine b
上,我收到以下错误:
警告:mysqli_stmt :: bind_param():无效的对象或资源mysqli_stmt
我不确定为什么会这样。这个错误是否发生在其他任何人的机器上?
<?php
$dbHost = "localhost";
$dbUser = 'ben2';
$dbPass = 'ben';
$dbname = 'test';
$mysqli = new mysqli($dbHost, $dbUser, $dbPass, $dbname);
if ($mysqli->connect_error) {
die('Connect Error (' . $mysqli->connect_errno . ') '
. $mysqli->connect_error);
}
$firstname = "David";
$lastname = "Peterson";
$stmt = $mysqli->stmt_init();
$stmt->prepare("INSERT INTO test (fn, ln) VALUES (?, ?)");
$stmt->bind_param("ss", $firstname, $lastname);
$stmt->execute();
?>