i make an php
web application for manage site products
i wanted to use jquery sortable
for sorting the product position i use this method:
var fixHelper = function(e, ui) {
ui.children().each(function() {
$(this).width($(this).width());
});
return ui;
};
$( "#sort tbody" ).sortable({
placeholder: "ui-state-highlight", axis: 'y', helper: fixHelper,
update: function (event, ui) {
var data = $(this).sortable('serialize');
// POST to server using $.post or $.ajax
$.ajax({
data: data,
type: 'POST',
url: '/www/order.php'
});
}
});
$( "#sort tbody" ).disableSelection();
and in order.php
i use this
<?php
include("db.php");
$i = 0;
foreach ($_POST['item'] as $value) {
Execute statement:
mysql_query(UPDATE cp_login SET [Position] = $i WHERE [EntityId] = $value);
$i++;
}
include("db-close.php");
?>
this is not working what should i type in [position]
section and [EntityId]
section i could not understand please give me fixed code with explanation .
thank you