title: php update multiple select option values in the database
body: <p>I have a database like this</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `ia_pages` (
    `pages_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `page_name` varchar(255) NOT NULL,
    `search_type` varchar(120) NOT NULL,
    `search_block_position` varchar(255) NOT NULL,
    PRIMARY KEY (`alphabet_search_id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
  
  
  
  INSERT INTO `ia_pages` (`pages_id`, `page_name`, `search_type`, `search_block_position`) VALUES
  (1, 'home_page', 'product_search', 'right_column'),
  (2, 'product_page', 'category_search', 'right_column'),
  (3, 'category_page', 'product_search', 'right_column');
  </code></pre>
  
  <p>and the html form like this</p>
  
  <pre><code>&lt;table id="admin-settings"&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;th&gt;Page Name&lt;/th&gt;
        &lt;th&gt;Search Type&lt;/th&gt;
        &lt;th&gt;Show Search in Block&lt;/th&gt;
      &lt;/tr&gt;
       &lt;tr&gt;
       &lt;td&gt;Home Page&lt;/td&gt;
       &lt;td&gt;
        &lt;select id="search_type" name="search_type"&gt;
          &lt;option value="product_search"&gt;Product Search&lt;/option&gt;
          &lt;option value="category_search"&gt;Category Search&lt;/option&gt;
        &lt;/select&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;select id="show_block" name="show_block"&gt;
          &lt;option value="left_column"&gt;Left Column&lt;/option&gt;
          &lt;option value="right_column"&gt;Right Column&lt;/option&gt;
        &lt;/select&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Product page&lt;/td&gt;
      &lt;td&gt;
        &lt;select id="search_type" name="search_type"&gt;
          &lt;option value="product_search"&gt;Product Search&lt;/option&gt;
          &lt;option value="category_search"&gt;Category Search&lt;/option&gt;
        &lt;/select&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;select id="show_block" name="show_block"&gt;
          &lt;option value="left_column"&gt;Left Column&lt;/option&gt;
          &lt;option value="right_column"&gt;Right Column&lt;/option&gt;
        &lt;/select&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Category page&lt;/td&gt;
      &lt;td&gt;
        &lt;select id="search_type" name="search_type"&gt;
          &lt;option value="product_search"&gt;Product Search&lt;/option&gt;
          &lt;option value="category_search"&gt;Category Search&lt;/option&gt;
        &lt;/select&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;select id="show_block" name="show_block"&gt;
          &lt;option value="left_column"&gt;Left Column&lt;/option&gt;
          &lt;option value="right_column"&gt;Right Column&lt;/option&gt;
        &lt;/select&gt;
      &lt;/td&gt;
    &lt;/tr&gt;            
     &lt;tr&gt;
      &lt;td style="text-align:center;" colspan="4"&gt;
        &lt;input type="submit" name="submit" value="save" class="button"&gt;
      &lt;/td&gt;
     &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Now when I make any changes when selecting any values in the form and click then it is making all the rows values same.
  My update query is like this</p>
  
  <pre><code>$host = 'localhost';
  $username = 'root';
  $username = 'root';
  $dbname = 'ia_pages';
  $con=mysqli_connect($host,$username,$username);
  mysqli_select_db($con,$dbname) or die ("no database");
  
  if (mysqli_connect_errno($con)) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
      $search_type = $_POST['search_type'];
      $show_block = $_POST['show_block'];
  
      if(isset($_POST['submit'])) {
           $update_query = "UPDATE `pages` SET `search_type` = '$search_type',`search_block_position` =  '$show_block'";
          $query_execute = mysqli_query($con, $update_query);
          if($query_execute) {
            echo "Data has been updated";
          } else {
            echo "data has not been updated";
            }
      }
  </code></pre>
  
  <p>Here it is changing all the values even only option has been changed. So all the values in the database has been converted to same. So how to fix this? I want to update the values in the database which has been changed in frontend.</p>