Hi All,
I have a table (with an ID of example) that can be seen here:
http://tinyurl.com/cfla7wp
The following script calls jeditable.js and makes the Telephone & Mobile columns editable. Once edited, the table shows the new value plus a * symbol.
<script type="text/javascript">
$(document).ready(function() {
/* Init DataTables */
var oTable = $('#example').dataTable();
/* Apply the jEditable handlers to the table */
$('td:eq(4), td:eq(5)', oTable.fnGetNodes()).editable( 'update_table_tenants.php', {
"callback": function( sValue, y ) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
"submitdata": function ( value, settings ) {
return {
"row_id": this.parentNode.getAttribute("1"),
"column": oTable.fnGetPosition( this )[2]
};
},
"height": "14px"
} );
} );
</script>
What I need to do however is add the value entered into my database, but I do not know how to do this.
I believe I need to do something like:
UPDATE my_table VALUE whatever column has been edited in the table WHERE tenID is the same as the row selected in the table
i.e. if I update the MOBILE NUMBER of the person called BILL GATES it would find his tenID, update numMobile in the table called my_table
All help appreciated
Dave