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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:01:36+00:00 2026-05-22T02:01:36+00:00

So I am generating a table with php/mysql, and in this table are numbers

  • 0

So I am generating a table with php/mysql, and in this table are numbers in rows. I have a button that when clicked, adds +1 to this number value in the MySQL database. The problem is, I have to refresh the page for the new number to show up in the table.

I am attempting to show the new number immediatly through a function on the success of the jquery button click event. So essentially I need to identify the HTML generated number in the table, then add +1 to it.

The problem is, the table is generated with a while function in php, so each row gets its own ID on the fly.

Hope this all makes sense.

Here is my Jquery code so far.

   $('.upArrow').click(function(){
   //this is finding the uparrow button that adds +1
   var row = $(this).attr('rowid');

    $.ajax({
    type: "GET",
    url: "upArrow.php?id="+row,
    cache: false,
    async: false,
    success: function(result){
    //this is tricky part, how do I select the displayed number part of the
    // table, then Add 1?

    },
    error: function(result){
        alert('Error, please try again.');
    }
    });
});

Edit: Here is a piece of my HTML table:

    <td id="musicDisplay" colspan="2">

    <div id="newUpArrow">
        <a href="javascript:void(0)" class = "upArrow"
        rowid="' . $row['id'] . '"><img src="../Img/upArrow.gif"/>
            </a> </div>

     <!--Here is the number I want to change.-->
    <div>'. $row['points'] . '</div>
 </td>
  • 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-05-22T02:01:37+00:00Added an answer on May 22, 2026 at 2:01 am

    In theory, you’ll want to set the context of your ajax request to the element containing the text you want. Then on success, you would increase the number in that context.

    $.ajax({
        /* everything else as before */
        context: $('selector for element containing number to increase'),
        success: function(result) {
            $(this).html(parseInt($(this).html(), 10) + 1);
        }
    });
    

    This assumes that the content of the context element will always be a single integer

    If you need to select a cell by it’s column and row, you could do the following:

        var column = 1;
        var row = 1;
    
        var $cell = $('table tr:eq(' + row + ') td:eq(' + column + ')');
    
        $cell.html(parseInt($cell.html(), 10) + 1);
    

    See fiddle: http://jsfiddle.net/xixionia/4HLp9/

    Although, you would need to change “table” to a table’s id, otherwise you’ll end up selecting all of the cells from every table at that row in and column.

    Note: Having seen your html, we would be able to provide a much more detailed description of how to select the desired cell.

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

Sidebar

Related Questions

I have a PHP web application which uses a MySQL database for object tagging,
Does anyone have a technique for generating SQL table create (and data insert) commands
I am developing a web application with PHP and MySQL. I have an entity
Although I have experience with SQL and generating HTML reports with PHP, I'm a
I am generating a report in php (mysql), ex: `select count(id) as tot_user from
I am developing an URL bookmark application (PHP and MySQL) for myself. With this
I created a setup.php to handle MySQL table generation, and as an obvious precaution
I have a MySQL table , each row representing a Person. For each person
following the answers i got on this thread PHP MySQL Query to get most
I am generating an HTML table with PHP (using the codeigniter framework) and I'm

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.