I am trouble getting my prepared statement to work. It seems like I do something wrong with the if ($conn->query($sql) === TRUE) {. I just need my code to work without passing error code.
"Warning: mysqli::query() expects parameter 1 to be string, object given in"
What am I supposed to do here? Can someone please tell what I need to do?
I have tried different things that is provided on the net without success.
<?php // sqltest.php  
require_once 'login.php';  
print "
        <form method='post'>
        <i><h>EDIT </h></i>
        <br>
        <input type='text' name='username'/>Title
        <br>
        <input type='password' name='password'/>Author
        <br>
        <input type='submit' value='Edit'>
        ";
$conn = new mysqli($hn, $un, $pw, $db);  
if ($conn->connect_error) die($conn->connect_error);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
$firstname = "John";
$lastname = "Doe";
$email = "john@example.com";
$sql = $conn->prepare("INSERT INTO classics (author, title, type) VALUES (?, ?, ?)");
$sql->bind_param("sss", $firstname, $lastname, $email);
// set parameters and execute
$sql->execute();
if ($conn->query($sql) === TRUE) {
    echo "Record updated successfully";
} else {
    echo "Error updating record: " . $conn->error;
}
$conn->close();
?>
My code is getting a object and not string
 
     
    