title: Update values inside while loop PHP with same ID
body: <p>Until now i can't solve my problem regarding this update by the way i have 2 columns </p>
  
  <p>ID AND COLOR</p>
  
  <p>In my saving i have this</p>
  
  <pre><code>Number of color: 4
  Color 1: RED
  Color 2: BLACK
  Color 3: YELLOW
  Color 4: BLUE
  </code></pre>
  
  <p>Now it is successfully saved in my database now i want to update color into this</p>
  
  <pre><code>Color 1: GREEN
  Color 2: YELLOW
  Color 3: BLACK
  Color 4: WHITE
  </code></pre>
  
  <p>In testing phase using for loop i'm getting the right color combination</p>
  
  <pre><code>$color1 = $_POST['color1'];
  $count = count($color1);
  
  for ($x = 0; $x &lt;=$count; $x++) {
  
          echo  $savecolor = $color1[$x];
  }
  </code></pre>
  
  <p>But when i add my update codes like this</p>
  
  <pre><code>$color1 = $_POST['color1'];
  $count = count($color1);
  
  for ($x = 0; $x &lt;=$count; $x++) {
  
  $savecolor = $color1[$x];
  
  $stmt = $db-&gt;prepare('UPDATE productcolor SET colorName = :color WHERE  productinformationID=:productinformationID');
  
  $stmt-&gt;execute(array(':color' =&gt; $savecolor, ':productinformationID' =&gt;$prodID));
  
  
  }
  </code></pre>
  
  <p>It turn out like this</p>
  
  <pre><code>Color 1: WHITE
  Color 2: WHITE
  Color 3: WHITE
  Color 4: WHITE
  </code></pre>
  
  <p>In actual database it looks like this</p>
  
  <pre><code>productcolorID(PK)       productinformationID(FK)       color
  306                      50                             ORANGE
  307                      50                             ORANGE
  308                      50                             ORANGE
  309                      50                             ORANGE
  </code></pre>
  
  <p>the prodID is from</p>
  
  <pre><code> $prodID   = $row['productinformationID']; its equals to 50
  </code></pre>
  
  <p>Can you help me guys so my color will not copy same color in my fields. 
  I have been stocked here a week. Hope you help me guys. Thank you!</p>