When I run the following code with mysqli on machine a
there is no issue executing the query and reviewing the data. However on machine b
, I receive the following error:
Warning: mysqli_stmt::bind_param(): invalid object or resource mysqli_stmt
I am unsure as to why this would be. Does this error occur on anyone else's machine?
<?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();
?>