I have the following table:
           questions_answers
 _____________________________________
| id | question_id | answer | user_id |
|____|_____________|________|_________|
|  1 |      1      |   yes  |    3    |
|____|_____________|________|_________|
I want to check if question_id and user_id exist, Then update the existing row.
I tried this command INSERT INTO questions_answers (question_id, answer, user_id)  VALUES (1, 'no',3) ON DUPLICATE KEY UPDATE answer = 'no'
So in this case there is a question_id = 1 and user_id = 3, Hence it should update that row and not insert a new row.
But I think it checks the id column for dublicates.
Is there is a way to get this done with SQL or I need to check if row exists with PHP, then update?
 
    