Question: how to make, that when loading new photo old is deleted (from a DB and the server)?

Closed due to the fact that the essence of the issue is incomprehensible by the participants Max Mikheyenko , Alex , Cerbo , user185447 , nörbörnën Oct 20 '15 at 22:15 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

    3 answers 3

    Delete the file via unlink and UPDATE the records in the database:

    unlink("file.gif"); $Query = "UPDATE `table` SET avatar='..' WHERE .. "; 

      It is necessary to delete the old one, then load the new one and update the name in the database.
      In general, formulate the question more clearly in order to get a more detailed answer.

        By the way, ling correctly wrote, formulate the problem and get an adequate response.

        And somehow it is not clear you mean only the database or database and file system.