WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ok, i have used wp_list_table to read data from a custom db table and i like to be able to update the database table by clicking the correspondig cell. Defaults are 0 and when clicked the value is set to 1.

so by clicking the cell updateVisitor() will be triggered "inline"

my function which i isn't part of the Visitors extend WP_list_table class

function updateVisitor($id){
    global $wpdb;
    $query = $wpdb->prepare( "UPDATE tbl_visitor SET visitorPayed =BINARY(visitorPayed=1) WHERE visitorID = %d", intval($id) );
    $result = $wpdb->query( $query );
share|improve this question
ok i think i must go the jquery/ajax way but i need to refresh the page to get the updated value to show ??? – alex Feb 27 '13 at 22:16

ok not the most handsome solution but it works

i transported the update function to update.php also wp-load.php

         visitorID = $(this).attr('id');
         //alert('testing '+visitorID);
         $.ajax({ url: 'update.php',
             data: {action: visitorID},
             type: 'post',
             success: function(output) {
            window.location.reload(); //reload so we see the updated values
    });//#end click
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.