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

  • Home
  • SEARCH
  • 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 8512803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:22:55+00:00 2026-06-11T04:22:55+00:00

I have three pages : 1)index.php (get results from select.php and put them into

  • 0

I have three pages :

1)index.php (get results from select.php and put them into div#result )

2)select.php (loops into MySQL’s table)

3)delete.php (gets user_id as a parameter and deletes it from MySQL’s table).

My goal is : After user clicks on delete! to show updated results (after changes/deletes)

from MySQL’s table

my problem is I could not know how to tell jQuery: listen process delete.php?id=123 & then

reload select.php while staying in index.php without redirecting to delete.php

so user actually does not see what happens or does not see that he’s being redirected to

another page.

index.php

<html>
    <title>a</title>
    <head>
        <script type="text/javascript" src="jquery-1.8.0.js"></script>
        <script type="text/javascript">
            $(function() {
                $('#result').load('select.php');
            });
        </script>
    </head>
    <body>
        <div id="result"></div>
    </body>
</html>

select.php

<?php
    $con = mysql_connect("localhost","root","123");
    if (!$con) { die('Could not connect: '); }
    mysql_select_db("test", $con);

    $result = mysql_query("select * from users");   

    while($rs3 = mysql_fetch_array($result)) {
        echo $rs3["user_email"]." ".$rs3["user_name"]." ";
        echo "<a href=delete.php?id=".$rs3[user_id].">Delete</a>";
        echo "<br />";
    }
?>

delete.php

<?php
    $con = mysql_connect("localhost","root","123");
    if (!$con) { die('Could not connect: '); }
    mysql_select_db("test", $con);

    $id = mysql_escape_string($_GET["id"]);
    $delete = "delete from users where user_id='{$id}'";
    @mysql_query($delete);
?>

thank you.

  • 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-11T04:22:57+00:00Added an answer on June 11, 2026 at 4:22 am

    Create not links, but AJAX query for delete. Make JQuery call for links. For example:

    <script type="text/javascript">
    $(function() {
    
        function refreshContent(){
            $('#result').load('select.php');    
        }
    
        $('#result').on('click','a',function(event){
            // prevent going by link `href`
            event.preventDefault();
    
            // get deleting row id
            var ids = $(this).data('ids');
    
            // make AJAX call for delete
            $.get("delete.php", { id: ids},function(data){
                // on success - refresh tcontent
                refreshContent();
            });
    
            return false;
        });
    
        // making content load on start
        $(document).ready(function(){
            refreshContent();
        });
    
    });
    </script>
    

    Also u must add ids in <a>. In this line:

    echo "<a href='delete.php?id=".$rs3[user_id]."' data-ids='".$rs3[user_id]."'>Delete</a>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page (index.php) that pulls posts from mysql database. The posts are
I have three files; index.php, searchbar.php and search.php now when i have search.php show
For example, I have created two pages and two MySQL tables. Index.php & citys.php
I have an index page with three links as follws. When I click the
I'm playing with a GWT/GAE project which will have three different pages, although it
Say I have three separate color schemes that are used on various pages in
I have an activity with a view pager and three pages to display. When
I have implemented horizontal page view. One base page and three swipe pages. The
I have a php page that pulls data from a mysql database based on
I am trying to get new content from database with php, here is the

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.