title: Can't update data in mysql database (wordpress)
body: <p>I am trying to update data in my database from WP website page using "select" value.</p>
  
  <p>This is how my "select" look like:</p>
  
  <pre><code>&lt;select onchange="getState(this.value)" name="state_selector1" id="state_selector1"&gt;
  </code></pre>
  
  <p>Here is my JS script:</p>
  
  <pre><code>function getState(ns) {
      jQuery.ajax({
          url: "/getVal.php",
          type: "GET",
          data: "newState=" + ns,
          success: function(output) {
              alert("Статус статьи изменен. " + output);
          }, error: function() {
            alert('Something went wrong.');
          }
      });
  };
  </code></pre>
  
  <p>And getVal.php:</p>
  
  <pre><code>&lt;?php
  
      global $wpdb;
  
      $newState = $_GET['newState'];
      $intNewState = (int)$newState;
      var_dump($intNewState);
      $stateUpdate = $wpdb-&gt;update( 'application',
          array( 'state' =&gt; $intNewState ),
          array( 'id' =&gt; 1 )
      );
  
  ?&gt;
  </code></pre>
  
  <p>I get 500 Internal server error every time I change value of "select".
  JS gets select value with no problem, as well as PHP, but I get error when I add "$wpdb->update" or "$wpdb->query" in getVal.php.</p>