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 7817663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:18:22+00:00 2026-06-02T06:18:22+00:00

I have the following that is generate for every record in my database $allbills

  • 0

I have the following that is generate for every record in my database

$allbills = mysql_query("SELECT * FROM outgoings WHERE outgoings.user_id = '$uid'") or die(mysql_error()); 

        echo "<table>";
        while($info = mysql_fetch_array( $allbills )) 
         { 
         echo "<tr>"; 
         echo "<th>bill id:</th> <td>".$info['id'] . "</td> ";
         echo "<th>total:</th> <td>".$info['bill'] . "</td> ";
         echo "<th>bill name:</th> <td>".$info['bill_name'] . "</td> ";
         echo "<th>bill deposit:</th> <td>".$info['bill_description'] . "</td> "; 
         echo "<th>colour:</th> <td>".$info['bill_colour'] . " </td>"; 
         echo "<th>edit:</th> <td>

         <form class='bill-upd'>
             <input type='hidden' value='".$info['rand']."' name='rand2' id='rand2'>
             <input type='hidden' value='".$info['id']."' name='billid' id='billid'>
            Total <input type='text' id='total' name='total' /><br />
            Bill name<input type='text' id='bill-name' name='bill-name' /><br />
           bill descriptiion <input type='text' id='bill-description' name='bill-description' /><br />
            bill colour<input type='text' id='bill-colour' name='bill-colour' />
        <input type='button' value='submit' class='bill-upd-submit' />
        </form>   

         </td>"; 
         echo "</tr>";
         }
         echo "</table>"; 

This updates my users record in a table using AJAX

$(document).ready(function(){   
    $(".bill-upd-submit").click(function() {
        var elem = $(this);
        $.post('update_bill.php', elem.parent('.bill-upd').serialize(), function(data) {
            elem.append(data);
        });
    });
});

Once this is done however, the user needs to refresh the page to see the results, is there a way I can populate the table the user edits, with the latest data after the update query takes place?

  • 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-02T06:18:24+00:00Added an answer on June 2, 2026 at 6:18 am

    I would try a different approach:

    1) Add an invisible div right after your button. You can do this dynamically:

    $(document).ready(function() {
       $(".bill-upd-submit").after("<div style='display:none'></div>");
        // ...
    });
    

    2) Now your post event would be as follows:

     $(".bill-upd-submit").click(function() {
          var elem = $(this);
          $.post("update_bill.php", elem.parent(".bill-upd").serialize(), function(data) {
                elem.next("div").html(data);
          });
    });
    

    BTW, I’m assuming that there are other buttons in the same page, and that’s the reason for using class (bill-upd-submit) instead of id. If there is just one button, id is faster. Also, I think that bill-upd-submit is of type button. If it is type submit, I would change-it to button or added the following to the click event:

    function() {
        // ... the code shown above
        return false;
    });
    

    This will prevent the form’s submit to happen.

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

Sidebar

Related Questions

I have the following piece of code that generate a jquerymobile-style button <a href=#
I have the following that I retreive the title of each url from an
I have the following problem: I have a feed capturer that captures news from
I have the following XSD fragment that is from a Vendor, I can't change
I have the following graph that I generated using ggplot2 I had finalPlot as
I have the following SVG source code that generates a number of boxes with
I have a class that has the following property that is generated by the
I have an application that uses Hibernate. It generated the following SQL statement. I
I have following script that executes all the .reg files in the current directory.
I have following code that I am compiling in a .NET 4.0 project namespace

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.