I am creating a simple employee management system for practicing php & Mysql. Admin can add, edit & delete all the staffs, Admin can also upload image for every employees
I know how to upload images but, how do i update uploaded images, Like for example admin wants to change the profile image of an staff? I don't want to delete the old image it should be there and the front page should show updated new image, The admin can view and delete all images of staffs from a seperate page..
The profile page will be like profile.php
which will show all the details of an employee including his profile image. I know how to create this. In that page there will be a link called view all images which will go to profile_images.php?id=USERS
ID all those undeleted old images should be shown here.
How do i design a database for this thing..
Currently my database looks like this
Looking for your help.. Thanks :)
You should only store one path/filename to the profile pic in your database table. If you upload a new one you need to replace the old filename with the new filename and the image will be replaced.
If you want to store 'old' images, then there is no magic fix. You have to build this using Logic.
Then you can display all 'old' images, from the separate table, if they exist, and regardless of how many there are, keeping the 'main' image in the main table.