Remove button doesn't work in Jeditable PHP MySQL

Remove button doesn't work in Jeditable PHP MySQL

vili999vili999 Posts: 1Questions: 0Answers: 0
edited September 2013 in Plug-ins
[quote]I use this example http://jquery-datatables-editable.googlecode.com/svn/trunk/index.html and PHP &MySQL. I can't select row, Remove button become active, after click Remove button and nothing.

Delete.php: [/quote]

[code]<?php

$database="111111";
$host="localhost:3306";
$user="1111111";
$password="111111";
$table="books";

mysql_connect($host,$user,$password);
mysql_select_db($database) or die( "Unable to select database");

$id = $_POST['id'];

$query = "delete from $table where id=$id";
$result = mysql_query($query);


if (!$result) { echo "Delete failed: $query"; }
else { echo "ok"; }

mysql_close();
?> [/code]

[quote] index.php[/quote]
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">



DataTables (table plug-in for jQuery) Data Manager Add-on




@import "media/css/demo_page.css";
@import "media/css/demo_table.css";
@import "http://www.datatables.net/media/css/site_jui.ccss";
@import "media/css/demo_table_jui.css";
@import "media/css/themes/base/jquery-ui.css";
@import "media/css/themes/smoothness/jquery-ui-1.7.2.custom.css";
/*
* Override styles needed due to the mix of three different CSS sources! For proper examples
* please see the themes example in the 'Examples' section of this site
*/
.dataTables_info { padding-top: 0; }
.dataTables_paginate { padding-top: 0; }
.css_right { float: right; }
#example_wrapper .fg-toolbar { font-size: 0.8em }
#theme_links span { float: left; padding: 2px 10px; }











$(document).ready( function () {
var id = -1;//simulation of id
$('#example').dataTable({ bJQueryUI: true,
"sPaginationType": "full_numbers"
}).makeEditable({
sUpdateURL: function(value, settings)
{
return(value); //Simulation of server-side response using a callback function
},
sAddURL: "add.php",
sAddHttpMethod: "GET",
sDeleteHttpMethod: "GET",
sDeleteURL: "delete.php",
"aoColumns": [
{ cssclass: "required" },
{
},
{ indicator: 'Saving platforms...',
tooltip: 'Click to edit platforms',
type: 'textarea',
submit:'Save changes'
},
{
indicator: 'Saving Engine Version...',
tooltip: 'Click to select engine version',
loadtext: 'loading...',
type: 'select',
onblur: 'cancel',
submit: 'Ok',
loadurl: 'EngineVersionList.php',
loadtype: 'GET'
},
{
indicator: 'Saving CSS Grade...',
tooltip: 'Click to select CSS Grade',
loadtext: 'loading...',
type: 'select',
onblur: 'submit',
data: "{'':'Please select...', 'A':'A','B':'B','C':'C'}"
}
],
oAddNewRowButtonOptions: { label: "Add...",
icons: {primary:'ui-icon-plus'}
},
oDeleteRowButtonOptions: { label: "Remove",
icons: {primary:'ui-icon-trash'}
},
oAddNewRowFormOptions: {
title: 'Add a new browser',
show: "blind",
hide: "explode",
modal: true
} ,
sAddDeleteToolbarSelector: ".dataTables_length"
});

$('#example').dataTable().makeEditable({
"sAddURL": "add.php",
"sDeleteURL": "delete.php",
"sAddNewRowFormId": "addme",
} );
} );




var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17838786-2']);
_gaq.push(['_trackPageview']);

(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();




Books
Delete


Surname





Name





Title





Published





When Read








<?php

$database="111111";
$host="localhost:3306";
$user="1111111";
$password="111111";
$table="books";

mysql_connect($host,$user,$password);
mysql_select_db($database) or die( "Unable to select database");

echo '


';

$query = "show columns from $table";
$result = mysql_query($query);

while ( $row = mysql_fetch_assoc($result) )
{
$fieldname = $row['Field'];
if ( $fieldname == 'id' ) continue;
echo "$fieldname";
}

echo '



';

$query = "select * from $table";
$result = mysql_query($query);

while ( $row = mysql_fetch_assoc($result) )
{
$id = $row['id'];
echo "";

unset($row['id']);
foreach ($row as $key => $value)
{
echo "$value";
}
echo "";
}
echo '





';
?>
[/code]
This discussion has been closed.