title: Insert or Update with mysql if same two column
body: <p>I have a table to store client's answers.I want to use one mysql query to insert or update this table.
  My Table name : questionform_answer
  and columns >  ClientID QuestionID OptionID</p>
  
  <p>Each client can only have one same question id.For example</p>
  
  <pre><code> ClientID QuestionID OptionID
      1         1         1
      1         2         5
      2         1         3
  </code></pre>
  
  <p>I want to update OptionID if already exist ClientID and QuestionID.I don't want to use select query so taking so time.
  I tried </p>
  
  <pre><code>     ON KEY UPDATE
       Replace Into
  </code></pre>
  
  <p>But I could not.
  I use php so I tried first update query and if mysqli return fail insert row but it is also slow.
  MY insert and update code :</p>
  
  <pre><code>   Insert Into questionform_answer (ClientID,QuestionID,OptionID) values 
     ('$ClientID','$soruid','$cevapid')
  
  
     Update questionform_answer set OptionID='$cevapid' where 
     ClientID='$ClientID' and QuestionID='$soruid'
  </code></pre>