php image update query, how to update the query
<p>Exampe list view:</p>

<p><img src="https://i.stack.imgur.com/FBW6f.png" alt="image 1"></p>

<p>Example of edit view:</p>

<p><img src="https://i.stack.imgur.com/biqTR.png" alt="image 2"></p>

<pre class="lang-php prettyprint-override"><code> $imgData =addslashes (file_get_contents($_FILES['userfile']['tmp_name']));
     $sql = "INSERT INTO imgexam
                        (image, name)
                        VALUES
                        ('{$imgData}', '{$_FILES['userfile']['name']}');";
</code></pre>

<p>How to change the query, so it will update the current image instead of inserting a new one?</p>