title: How to write Insert and Update query in one single Query in mysql
body: <p>I have below mentioned Issue.</p>
  
  <p>I am developing inventory system using php.</p>
  
  <p>According to that i have to add invoiced items to table. </p>
  
  <p>Dynamically generated text box used to collect received item details. </p>
  
  <p>I have current_stock table and it contain Item-name and qty columns. </p>
  
  <p>Item-name is primary key field. </p>
  
  <p>item which i am going to insert if already exist quantity  should be updated with new value. </p>
  
  <p>if it is not exist should be inserted as a new row. </p>
  
  <p>This is must be done in loop because i use dynamically genarated text box and data collect using $item[] and $qty[] arrays. </p>
  
  <p>I am try to use several ways to solve this issue unable to execute in for loop but not yet success. </p>
  
  <p>please help me.........</p>