Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9091075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:31:27+00:00 2026-06-16T22:31:27+00:00

I want to execute a query during onload. How do I this? This is

  • 0

I want to execute a query during onload. How do I this?
This is my code.
This is the query I want to execute.

<?php
    mysql_query("UPDATE `requests` SET `stat_id`= 3 WHERE `proj_id`='".$_GET['projid']."' and DATE(`req_date`)='".$_GET['date']."'");   
?>

and I have a javascript

<script type="text/javascript">
$(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&date="+date+"&projid="+projid+"";
    });
});
</script>

when the button approve is clicked the page is refreshed, but the query is not executing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:31:28+00:00Added an answer on June 16, 2026 at 10:31 pm

    You can use the following code in index.php for updating table

    <?php
    $con = mysql_connect("localhost","peter","abc123");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
    mysql_select_db("my_db", $con);
    
    mysql_query("UPDATE Persons SET stat_id=3 WHERE proj_id='".$_POST['projid']."' and DATE(`req_date`)=DATE('".$_POST['date']."')");
    
    mysql_close($con);
    ?> 
    

    Check w3Schools

    Then use ajax to call this page

    $.ajax({
      type: "POST",
      url: "Index.php",
      data: { projid: projid , date: date }
    }).done(function( msg ) {
      alert( "Data Saved: " + msg );
    });
    

    jQuery ajax reference

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ok i want to execute this query in PHPMyAdmin update dle_post set full_story =concat(full_story
I want to execute a query like this var result = from entry in
I have have this query that i want to execute. SELECT warehouse.expiry_date, pharmacy.expiry_date, drugs.active_substance,
I want to execute this query : INSERT INTO [Order] (FactorId, ProductId, Entity) VALUES((SELECT
I want to execute my HQL query like this: Query queryPayment=sixSession.createQuery(from Payment where vcode=:p_Vcode
I want to execute this query in SQL Server but it didn't work :
I want to execute a query but php/mysql throws Call to a member function
I want to execute a query in MySQL but it won't work. This is
Hi I want to execute this query SELECT * FROM nm_ticket WHERE id_urgencia IN
i want to execute the query in master database it self IF OBJECT_ID(N'DB1.dbo.T_table1', N'U')

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.