Php & Mysql Image updating and deleting -
i creating simple employee management system practicing php & mysql. admin can add, edit & delete staffs, admin can upload image every employees
i know how upload images but, how update uploaded images, example admin wants change profile image of staff? don't want delete old image should there , front page should show updated new image, admin can view , delete images of staffs seperate page..
the profile page profile.php
show details of employee including profile image. know how create this. in page there link called view images go profile_images.php?id=users
id undeleted old images should shown here.
how design database thing..
looking help.. :)
you should store 1 path/filename profile pic in database table. if upload new 1 need replace old filename new filename , image replaced.
if want store 'old' images, there no magic fix. have build using logic.
- when uploading image
- if 1 exists
- copy existing image filename new table, user id
- if 1 exists
- process new image , store new filename
then can display 'old' images, separate table, if exist, , regardless of how many there are, keeping 'main' image in main table.
Comments
Post a Comment