2013-11-26 133 views
0

我有問題刪除行,我想是因爲post [id]沒有被髮送。顯示刪除消息,但該行不會被刪除。這裏是我的代碼:刪除行Jtable jquery

JAVASCRIPT:

$(document).ready(function() { 

    $('#PersonTableContainer').jtable({ 
     title: 'Tabla de Clientes', 
     paging: true, 
     pageSize: 10, 
     sorting: true, 
     defaultSorting: 'Nombre ASC', 
     actions: { 
      listAction: 'AccionesClientes.php?action=list', 
      createAction: 'AccionesClientes.php?action=create', 
      updateAction: 'AccionesClientes.php?action=update', 
      deleteAction: 'AccionesClientes.php?action=delete', 
     }, 
     fields: { 
      id: { 
       key: true, 
       create: false, 
     edit: false, 
     list: false 
      }, 

PHP:

else if($GET["action"] == "delete") 
{ 
//Delete from database 
$result = mysqlquery("DELETE FROM clientes WHERE id= ".$_POST["id"].";"); 

    //Return result to jTable 
    $jTableResult = array(); 
    $jTableResult['Result'] = "OK"; 
    print json_encode($jTableResult); 
} 

任何人都可以看到那裏的錯誤是什麼?

回答

0

對不起,我不就行了方法

$result = mysql_query("SELECT **id as id**, nombre as Nombre, apellido1 as Apellido1, cedula as Cedula, empresa as Empresa, nit as Nit FROM clientes ORDER BY " . $_GET["jtSorting"] . " LIMIT " . $_GET["jtStartIndex"] . "," . $_GET["jtPageSize"] . ";"); 

這解決了問題給予id字段的任何值。