I am trying to do a prepared statement. My code is below. I use PHP and MySQLi. I get this error message:
Fatal error: Call to a member function prepare() on a non-object in/path/path/
$sql = "INSERT INTO person(name, $lastname)
VALUES (?, ?)";
$stmt = $sql->prepare($sql);
$stmt->bind_param("ss", $name, $lastname);
$name= '?';
$lastname='?';
$stmt->execute();
The error message points to this line:
$stmt = $sql->prepare($sql);
What is the issue?