title: Excecute a query in Wordpress Admin Dashboard
body: <p>I'm trying to build a plugin to manage a custom table in Wordpress. In this plugin I'm gonna write 3 functions. First one to fetch data from database as you can see in the screenshot below. The second function is to update record status. And the last function is to delete a record.</p>
  
  <p>My problem is I don't know how to link the function to the links in Action column. Wordpress doesn't allow me or I don't know how to send a query to to delete or update records.</p>
  
  <p>I want if I click on update, status of the record I click choose will be changed then reload the page. And if I click on delete then reload the page, it will delete that record. I can write the functions but no luck to send ID query to it.</p>
  
  <p>Please help. Thank you.</p>
  
  <p><a href="https://i.stack.imgur.com/u3Gr4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u3Gr4.png" alt="enter image description here"></a></p>
  
  <pre><code>&lt;?php
  /*
  Plugin Name: Manage Custom Table
  Plugin URI: http://_adddress.com
  Description: Testing Plugin
  Author: XXXXXXXXXX
  Version: 1.0
  */
  require_once('functions/functions.php');
  add_action('admin_menu','ManageCustomTable_admin_actions');
  function ManageCustomTable_admin_actions() {
      add_options_page('Manage Custom Table','Manage Custom Table','manage_options',__FILE__,'ManageCustomTable_admin');
  }
  function ManageCustomTable_admin(){
      global $wpdb;
  
      $data = $wpdb-&gt;get_results  ("
                      SELECT
                          id,
                          school_id,
                          added_date,
                          campus_status
                      FROM
                          table_campus
                  ");
      ?&gt;
      &lt;style&gt;.notice-warning {display:none;}&lt;/style&gt;
      &lt;table class="widefat" style="margin:20px auto; width:97%;"&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;ID&lt;/th&gt;
                  &lt;th&gt;School ID&lt;/th&gt;
                  &lt;th&gt;Added Date&lt;/th&gt;
                  &lt;th&gt;Status&lt;/th&gt;
                  &lt;th&gt;Action&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tfoot&gt;
              &lt;tr&gt;
                  &lt;th&gt;ID&lt;/th&gt;
                  &lt;th&gt;School ID&lt;/th&gt;
                  &lt;th&gt;Added Date&lt;/th&gt;
                  &lt;th&gt;Status&lt;/th&gt;
                  &lt;th&gt;Action&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/tfoot&gt;
          &lt;tbody&gt;
          &lt;?php
          foreach ($data as $data) {
              echo '&lt;tr&gt;';
              echo '&lt;td&gt;'. $data-&gt;id.'&lt;/td&gt;';
              echo '&lt;td&gt;'. $data-&gt;school_id.'&lt;/td&gt;';
              echo '&lt;td&gt;'. $data-&gt;added_date.'&lt;/td&gt;';
              echo '&lt;td&gt;'. $data-&gt;campus_status.'&lt;/td&gt;';
              echo '&lt;td&gt;'; 
              ?&gt;
              &lt;a href=#&gt; Update &lt;/a&gt;
              &lt;a href=#&gt; Delete &lt;/a&gt;
              &lt;?php
              echo '&lt;/td&gt;&lt;/tr&gt;';
          }
          ?&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
  &lt;?php
  }
  ?&gt;
  </code></pre>