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.

  1. a user click on update profile page, redirects edit profile page.
  2. there's user upload image. default value blank user has picture uploaded database.
  3. if user click on update, image on database overwritten blank.
  4. 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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -