Hi i am planning to delete and insert values at the same time when i click submit it will delete the old values and at the same time it will insert new values
Here is my code.
<?php    
if (isset($_POST['submit'])) {    
  $color1 = $_POST['color1'];
  $count = count($color1);       
  for ($x = 0; $x <=$count; $x++) {
    $savecolor = $color1[$x];
    $stmt = $db->prepare("DELETE FROM productcolor WHERE productinformationID =  :field0");
    $stmt->execute(array(':field0' => $prodID));    
    $stmt = $db->prepare("INSERT INTO productcolor(productinformationID,colorName) VALUES(:field0,:field00)");
    $stmt->execute(array(':field0' => $prodID, ':field00' => $savecolor));
   } 
} 
?>
It only delete my values there's no value saving in my database..
Please help me. Thanks
 
     
     
    