我想获得订单的ID。
Javascript代码:
$(document).ready(function() {
var fixHelper = function(e, ui) {
ui.children().each(function() {
$(this).width($(this).width());
});
return ui;
};
$("#sort tbody").sortable({
helper: fixHelper,
scroll: false,
update: function () {
var sorted = $( "#sort tbody" ).sortable( "serialize", { key: "id" } );
$.post(path+"/web_data/ajax/admin/ajax.savePositions.php",{ 'num': sorted});
}
}).disableSelection();
});
Javascript Post:
num id=2&id=1
我的PHP代码:
if(isset($_POST['num'])){
$sort = $_POST['num'];
$orderlist = explode('id=', $sort);
foreach ($orderlist as $k) {
echo $k;
} }
PHP echo
2&1
我想将此ID保存在数据库中,如下所示:
UPDATE `upload_categories` SET `order_num` = '2' WHERE `id` =1;
UPDATE `upload_categories` SET `order_num` = '1' WHERE `id` =2;
任何人都可以帮助我:/