如何将订单保存到数据库中?

I want to get the Id's of the orders.

Javascript Code:

    $(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

My PHP Code:

if(isset($_POST['num'])){
$sort = $_POST['num'];  

$orderlist = explode('id=', $sort);
foreach ($orderlist as $k) {
    echo $k;
} }

PHP echo

2&1

I want to save this ID's in Database like this:

UPDATE `upload_categories` SET `order_num` = '2' WHERE `id` =1;
UPDATE `upload_categories` SET `order_num` = '1' WHERE `id` =2;

Can anyone help me :/