How to update a new image into database by replacing the existing one

Recommended Answers

All 3 Replies

Do you mean how do to update an image file path in a database?
if you are using mysql it would be:

UPDATE [table name] SET [field name]='newimage.jpg' where [field name]='oldimage.jpg';

Are you trying to do this within a php script?
I hope this helps.

no i dont just want to replace single image.My task is if an user updates his records all the time he is not going to change image.Once he wishes to change the image should be replaced otherwise the image already present should exist over in database

no i dont just want to replace single image.My task is if an user updates his records all the time he is not going to change image.Once he wishes to change the image should be replaced otherwise the image already present should exist over in database

So for that you need to check that user has images selected or not.
If image is selected then upload image and update the database.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.