title: How to add comma separated values to database as separate records?
body: <p>I have a table named product_table as below with two fields product_id and comp_prod</p>
  
  <p>The values for comp_prod will be sent as comma separated values like 4,3</p>
  
  <p>but the value of product_id will be common</p>
  
  <p>I want to insert the comma separated values as separate rows as follows with product_id as common. How can i do that using php and mysql ?</p>
  
  <p>product_table</p>
  
  <pre><code>+-----+----------+-----------------+    
  | id | product_id  |comp_prod      |   
  +-----+----------+-----------------+    
  |1  |      339     |  4            |   
  |2  |      339     |  5            |   
  +------------+---------------------+     
  </code></pre>