I am having problems deleting rows, I think is because the post[id] is not being sent. The delete message displays but the row is not deleted. Here is my code:
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);
}
Can anybody see where the error is?
Sorry, I wasn't giving any value to the id field on the LIST method
$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"] . ";");
This solves the problem.