How to UPDATE in database using mysqli prepared statement?
<p>I'm using mysqli before to my query and now I convert it to mysqli prepared statements. I'm trying to update a particular data with upload image and I don't know why I get the error</p>
<blockquote>
<p>mysqli_stmt_bind_result(): Number of bind variables doesn't match number of fields in prepared statement in line 30</p>
</blockquote>
<p>Also, how can I execute the query in mysqli query like <code>mysqli_query($conn, $query)</code></p>
<p>Below is the code of my UPDATE query:</p>
<pre><code>if (isset($_POST['submit'])) {

    $imageName = mysqli_real_escape_string($conn, $_FILES[&quot;latest_photo&quot;][&quot;name&quot;]);
    $imageData = mysqli_real_escape_string($conn, file_get_contents($_FILES[&quot;latest_photo&quot;][&quot;tmp_name&quot;]));
    $imageType = mysqli_real_escape_string($conn, $_FILES[&quot;latest_photo&quot;][&quot;type&quot;]);

        if (substr($imageType, 0,5) == &quot;image&quot;) {

            $query = &quot;UPDATE `crew_info` SET `updated_photo` = ? WHERE `id` = ?&quot;;
            $stmt = mysqli_prepare($conn, $query);
            mysqli_stmt_bind_param($stmt, 'ss', $imageData, $_GET['id']);
            mysqli_stmt_execute($stmt);
            mysqli_stmt_bind_result($stmt, $id, $updated_photo);    

            //HOW CAN I EXECUTE THE QUERY HERE?
            echo &quot;Image Uploaded&quot;;

        }

        else {

            echo &quot;Image is not uploaded!&quot;;

        }

}
</code></pre>
<p>In the code above, there is a comment line on how to execute the query. How can I do that?</p>
<p>When I click the button Upload, it says that the image is uploaded but does not appear in the database. Why is that?</p>