i am trying to use jQuery in-place editor (http://code.google.com/p/jquery-in-place-editor/) on WordPress to update certain values of a custom made table in my database.
I am not really skilled with AJAX (first time trying to use it) or MYSQL, that's why I am having difficulties. I will try to explain my problem in the best way possible.
What I want is to change the value of the column (telephone) inside the table (wp_esn_cardholder). Each row has an unique ID (id_cardholder).
I can smoothly run the jQuery in-place js inside the page, calling for "save.php"
With save.php I try to update the value, using the following code
<?php global $wpdb; $update_value = $_POST['update_value']; $element_id = $_POST['element_id']; $original = $_POST['original_html']; $table = 'esn_cardholder'; $row_id = $_POST['element_id']; $data_array = array('telephone' => $_POST['update_value']); $where_array = array('id_cardholder' => $row_id); $wpdb->update( $wpdb->prefix . $table, $data_array, $where_array ) ?>
Using Firebug's console, I can see that the following passes through:
Parameters application/x-www-form-urlencoded element_id 278 original_html old-number original_value old-number update_value new-number Source update_value=new-number&element_id=278&original_html=old-number&original_value=old-number
The thing won't update the database, and I obviously don't know why. I know that I should sanitize the query but I can think about that once it works :).
Thanks in advance