Image Not Showing After Doing Update on PHP

So yesterday my friend, asked me about this case, she has some codes about edit request. the but after she success doing edit, the image at her database is gone.




So I’m wondering what happened and ask some question.

First, are you sure it was edit command? not insert? I mean if its insert, of course, the last image that she uploaded will gone if she did not put any image at that edit form.

Second, are you sure your update script is fine?

then after I check her codes I just add 5 lines to fix it (lol).


So since there’s no image inserted on her edit form like this

We need to check if the image variable has value or not like this.


And then walah, it’s fixed!



If we have edit case that needed to upload the images make sure to give if clause to check if there’s any value on it or not, if it has value then do this, if it does not then do this. Or you can get the value from the last input, it’s like transaction number one has image1.jpg in it, so what we need to do just do get image1.jpg value and put it back on update script. But this one isn’t a good way to fix it because we need to do upload many times.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s