Update/insert only a column of database table

enter image description here

I WordPress table named wp_fes_vendors, there is a total of 12 columns.

Out of these 12 columns, I want to only update the data of column name requests

The data i am getting for this column is from a custom form in backend stored in $_POST['getval']

Here is code i tried

 if (!empty(isset($_POST['getval'])))
    {       
            global $wpdb;
            $table_name=$wpdb->prefix.'fes_vendors';

            $data_array = array(

            'requests' => $_POST['getval']


            );

            $data_where = array('requests' => $_POST['getval']);

            $wpdb->update($table_name,$data_array,$data_where);


    }

Html

<form id="myForm" name="myform" action="" method="POST" style="padding:20px;">
  <label> Select if this Vendor wishes to receive customer requests or not: </label>
  <select name="getval" id="brandSel" size="1">
      <option selected="selected" disbaled value="">-- Select status --</option>
      <option value="1">Enable</option>
      <option value="0">Disable</option>
  </select>

  <?php submit_button('submit'); ?>
</form>

I tried several times but the data is not being saved /updated.
Here is picture of db

Read more here:: Update/insert only a column of database table

Leave a Reply

Your email address will not be published. Required fields are marked *