Hi I need to pass a variable called $process_id to the file "config/update.php" which is the file responsible for live table updating using DataTables.Editable.
This variable is an integer used to create a table (e.g. table1) so to update the specific table I need to have UPDATE table$process_id SET... and to be able to do that I need to pass that variable to the script that updates the table.
Here’s what I came up with after some research on the Datatables.Editable Wiki:
DataTables initialisation and addition of makeEditable function:
$('#example').dataTable().makeEditable({
sUpdateURL: "config/update.php",
oUpdateParameters: {
"process_id": "<?php echo $process_id; ?>"
}
});
And the update.php file
<?php
$id = $_REQUEST['id'] ;
$value = $_REQUEST['value'] ;
$column = $_REQUEST['columnName'] ;
$columnPosition = $_REQUEST['columnPosition'] ;
$columnId = $_REQUEST['columnId'] ;
$rowId = $_REQUEST['rowId'] ;
$column_name = trim($column);
$process_id = $_REQUEST['process_id'];
include("config.php");
// mysql_query(" UPDATE $sTable SET $column = $value WHERE trl_id = $id ");
mysql_query("UPDATE tw_tg_sim_lines$process_id SET $column_name = '$value' WHERE trl_id = '$id'");
echo $id;
?>
I have already tried the different methods such as $_POST, $_GET and $_REQUEST. Nothing seems to work, so the problem is in the oUpdateParameters.
Any help would be much appreciated, thank you.
I guess you need to make an ajax call to the php script
this worked for me in the past using jquery
refrenced here http://api.jquery.com/jQuery.ajax/