javascript - into my database `first_name` is showing as 0 and last_name is showing as "Arora" after updating name
Get the solution ↓↓↓Solution:
You're wide open to sql injection, as I stated before.
Your statement looks like that:
UPDATE admin SET first_name='$firstname' AND last_name='$lastname' WHERE id='$id' "
I think you want to use a comma instead of theAND
:
UPDATE admin SET first_name='$firstname', last_name='$lastname' WHERE id='$id' "
If you're a beginner, please don't put effort in deprecated language-parts like the mysql_ extension. Learn to do it right, just from the beginning. Use mysqli or PDO with prepared statements and bind your inputs to parameters.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: apache/2.4.52 (win64) openssl/1.1.1m php/8.1.2 server at localhost port 80
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.