Skip to content
Advertisement

Update specific row in MYSQL [closed]

In my application I can be able to upload an image for a user. I am maintaining the user_id as follows.

JavaScript

The problem is, if I will upload the user image, it will update all rows in the table. But if I manually changed the user_id as 1 instead of ADM-0001, then it will update the specific row.

Following is the PHP code,

JavaScript

Actually I a, wondering why it was happening. Please help me improve my code. Thanks in advance.

Advertisement

Answer

You are telling the bind-param method to convert the user_id into an integer. Change it to keep it as a string:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement