php - How do I avoid an image being overwritten to blank when user edit their profile? -
i have issue website. i'm using php , mysql.
- a user click on update profile page, redirects edit profile page.
- there's user upload image. default value blank user has picture uploaded database.
- if user click on update, image on database overwritten blank.
- on user's profile page, old image overwritten blank.
below html code upload image in profileedit:
<label style="padding-left:3em"> image: </label> <input type="file" name="image" id="image" value=""> </input>
and php script looks below:
mysqli_query("update people set image='$image' id=".$_get['id']);
please !
you check if there new image:
if (!empty($image)) { mysqli_query("update people set image='$image' id=".$_get['id']); }
Comments
Post a Comment