$_REQUEST['id'] is void

$_REQUEST['id'] is void

jabberjabber Posts: 23Questions: 1Answers: 0
edited November 2011 in DataTables 1.8
i find out DataTable just some week ago and i have to say it's really a very good plug-in.

Yesterday i started to use jquery.dataTables.editable.js plugin, when on server side i get id variable ( $id=$_REQUEST['id'];) i get a empty value.
Unlike, request on var value,columnName,columnPosition,columsId,rowId i get expected value.

CLIENT SIDE CODE:

[code]
$(document).ready(function() {

oTable = $('#grid-jquery-datatables').dataTable( {
"aoColumns":[
{ "mDataProp": "id_project" },
{ "mDataProp": "name" },
{ "mDataProp": "priority" }
],
"bProcessing": true,
"bServerSide": true,
"aaSorting": [[ 1, "desc" ]],
//"sAjaxSource": 'dataTablesStuffs/gProDatasource.txt',
"sAjaxSource": 'dataTablesStuffs/gProDatasource.php',
"sPaginationType": "full_numbers",
"bJQueryUI": true
}).makeEditable({
sUpdateURL: "php/actions.php",
});
})
[/code]

SERVER SIDE CODE:
[code]
<?php
// .. i include before all necessary code, DB connection, my constants etc

open_db_connection();

$id = $_REQUEST['id'];
$value = $_REQUEST['value'] ;
$column = $_REQUEST['columnName'] ;
$columnPosition = $_REQUEST['columnPosition'] ;
$columnId = $_REQUEST['columnId'] ;
$rowId = $_REQUEST['rowId'] ;

$table="project";


$query = "UPDATE $table SET $column=$value WHERE id_project = '$id'";

$result = mysql_query( $query, $link );
if (!$result) { echo "Database query error: " . mysql_error(); return; }

close_db_connection();

?>
[/code]


where i went wrong?

Thank you for your help!
J

Replies

  • jabberjabber Posts: 23Questions: 1Answers: 0
    Did anyone ever had this problem ?

    J
  • jabberjabber Posts: 23Questions: 1Answers: 0
    edited November 2011
    Lesson learned alone !
    After : "bJQueryUI", true

    i have inserted:

    [code]
    "fnRowCallback": function( nRow, aData, iDisplayIndex ) {
    $(nRow).attr('id', aData.id_project );
    return nRow;
    }
    [/code]
  • johnadamsyjohnadamsy Posts: 13Questions: 0Answers: 0
    @Jabber

    Thanks for sharing your code snippets on the cell editing feature. On a positive note, isn't it dangerous displaying database table attributes as in your code?: [code]oTable = $('#grid-jquery-datatables').dataTable( {
    "aoColumns":[
    { "mDataProp": "id_project" },
    { "mDataProp": "name" },
    { "mDataProp": "priority" }
    ],[/code]
    which is on the client side...is there another way of using database attributes (here columns of the affected table) without necessarily listing them by name?
  • jabberjabber Posts: 23Questions: 1Answers: 0
    edited March 2012
    @johnadamsy

    this is an interesting question but actually i have no idea :(
    I've created a new thread for this important question, see:
    http://datatables.net/forums/discussion/9160/show-table-fields-could-it-be-a-security-problem
This discussion has been closed.