Exampe list view:

![image 1](https://i.stack.imgur.com/FBW6f.png)

Example of edit view:

![image 2](https://i.stack.imgur.com/biqTR.png)

```php
 $imgData =addslashes (file_get_contents($_FILES['userfile']['tmp_name']));
     $sql = "INSERT INTO imgexam
                        (image, name)
                        VALUES
                        ('{$imgData}', '{$_FILES['userfile']['name']}');";

```

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