title: AJAX update database
body: <p>Sorry for not stated my problem. Actually I want to update my data in database.
  But the problem now is even i tried to choose approve or reject the ajax still won't update.
  I am new in ajax and try search around net but my code still got problem</p>
  
  <p>here is my php page</p>
  
  <pre><code>&lt;?php
            $querysel = "SELECT * FROM tblinternapplication WHERE course_code = '{$course_codeapp}' ORDER BY student_id, 1 DESC " ;
        $resultsel = mysql_query($querysel, $connection);
  
        echo "&lt;h2&gt;&lt;div class=\"h_title\"&gt;Status still in pending&lt;/div&gt;&lt;/h2&gt;";  
        echo "&lt;table&gt;";
        echo "&lt;thead&gt;";
        echo "&lt;tr&gt;";
        echo "&lt;th scope=\"col\"&gt;Matric ID&lt;/th&gt;";
        echo "&lt;th scope=\"col\"&gt;Company name&lt;/th&gt;";
        echo "&lt;th scope=\"col\" width = \"200\"&gt;Job Scope&lt;/th&gt;";
        echo "&lt;th scope=\"col\"&gt;Status&lt;/th&gt;";
        echo "&lt;th scope=\"col\"&gt;Action&lt;/th&gt;";
        echo "&lt;/tr&gt;";
        echo "&lt;/thead&gt;";
  
            while($rowsel = mysql_fetch_array($resultsel)){
                      if($rowsel['status_approval'] == NULL){
              $id = $rowsel['id'];
                      echo "&lt;tr&gt;";
                      echo "&lt;tr&gt;"."&lt;td class=\"align-center\"&gt;".$rowsel['student_id']."&lt;/td&gt;";
                      echo "&lt;td class=\"align-center\"&gt;".$rowsel['company_name']."&lt;/td&gt;";
                      echo "&lt;td class=\"align-center\" width = \"200\"&gt;".$rowsel['job_scope']."&lt;/td&gt;";
          echo "&lt;td class=\"align-center\"&gt;";
                      if($rowsel['status_approval'] != NULL){
                          if( $rowsel['status_approval'] == 0)
              {
                 echo "Reject";
              }
              else
              {
                 echo "Approve";
              }
                          }
                      else
                      {   echo "Pending";
                          }
                      echo "&lt;/td&gt;";
          echo "&lt;td class=\"align-center\"&gt;&lt;select name=\"approve\" 
           onchange=\"getstatus(this.value)\"&gt;";
              echo "&lt;option value=\"\"&gt;Select status:&lt;/option&gt;";
              echo "&lt;option value=\"1\"&gt;Approve&lt;/option&gt;";
              echo "&lt;option value=\"0\"&gt;Reject&lt;/option&gt;";
          echo "&lt;/select&gt;";
          echo "&lt;/td&gt;";
                      echo "&lt;/tr&gt;";
  
                      }
        }
        echo "&lt;/table&gt;";
  </code></pre>
  
  <p>here is my jscript page</p>
  
  <pre><code>&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt; 
  function getstatus(id, approve)
  {
  if (approve=="")
  {
  } 
  if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
  else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  
  xmlhttp.open("GET","updatestatus.php?id=" + id + "&amp;status=" + approve,true);
  xmlhttp.send();
  }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>then here is my updatestatus.php</p>
  
  <pre><code>&lt;?php require_once("../includes/session.php"); ?&gt;
  &lt;?php require_once("sessioncourse.php"); ?&gt;
  &lt;?php $course_codeapp = $_SESSION['course_code'] ; ?&gt;
  &lt;?php confirm_logged_in(); ?&gt;
  &lt;?php require_once("../includes/connection.php") ?&gt;
  &lt;?php require_once("../includes/functions.php") ?&gt;
  
  &lt;?php
  
  $id = $_GET['id'];
  $status =$_GET['status'];
  
  $sql="UPDATE tblinternapplication set status_approval  = $status WHERE id = $id ";
  
  $result = mysql_query($sql);
  ?&gt;
  </code></pre>
  
  <p>I work for few days but problem still cannot solve. Hope someone can help me. I will appreciate your help!</p>