title: Updating a MySQL table column with php array
body: <p>I've got the following array $weight and I want to store these values to the weight column in mysql table.</p>
  
  <pre><code>Array
  (
      [0] =&gt; 12
      [1] =&gt; 14
      [2] =&gt; 16
      [3] =&gt; 9
      [4] =&gt; 7
  )
  </code></pre>
  
  <p>The database table structure is,</p>
  
  <pre><code>+----------------------------+--------+------+
  | Indicators                 | Weight | Rank |
  +----------------------------+--------+------+
  | Elevation                  |      0 |    0 |
  | Distance from the sea      |      0 |    0 |
  | Natural Coastal Protection |      0 |    0 |
  | Water Bodies               |      0 |    0 |
  | Precipitation              |      0 |    0 |
  +----------------------------+--------+------+
  </code></pre>
  
  <p>I'm expecting the result as,</p>
  
  <pre><code>+----------------------------+--------+------+
  | Indicators                 | Weight | Rank |
  +----------------------------+--------+------+
  | Elevation                  |     12 |    0 |
  | Distance from the sea      |     14 |    0 |
  | Natural Coastal Protection |     16 |    0 |
  | Water Bodies               |      9 |    0 |
  | Precipitation              |      7 |    0 |
  +----------------------------+--------+------+
  </code></pre>
  
  <p>Tried the following query, but it doesn't seem to insert.</p>
  
  <pre><code>foreach($weight as $value)
      {
      $insert_weight="UPDATE geographic_main 
      SET Weight='$value' 
      WHERE Indicators=('Elevation','Distance from the sea',
      'Natural Coastal Protection','Water Bodies', 'Precipitation') ";
  </code></pre>
  
  <p>I'm not sure if I'm right in the WHERE part. Please suggest.
          }</p>