title: execute query onload page
body: <p>I want to execute a query during onload. How do I this?
  This is my code.
  This is the query I want to execute.</p>
  
  <pre><code>&lt;?php
      mysql_query("UPDATE `requests` SET `stat_id`= 3 WHERE `proj_id`='".$_GET['projid']."' and DATE(`req_date`)='".$_GET['date']."'");   
  ?&gt;
  </code></pre>
  
  <p>and I have a javascript</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function(){
      $('input#approve').click(function(){
          var date = $(this).parent().attr('id');
          var projid = $(this).parent().attr('class');
  
          window.location.href="index.php?page=requests&amp;date="+date+"&amp;projid="+projid+"";
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>when the button approve is clicked the page is refreshed, but the query is not executing.</p>