I am using Jquery sortable, but I'm not able to update the database with the position user has chosen, maybe somebody can help me

Here is jquery and ajax :

Code:
$(function () {
    $('.drag').sortable({
    connectWith: '.drag',
    update : function(e, ui) {
        var id=$(this).attr('id');
        var ul = $(ui.item).closest('.drag');
        var index = 0;
        var toPost = {};
        ul.find('> li').each(function() {
        index++;
        $(this).find('input').val(index);               
        toPost[$(this).find('input').attr('name')] = index;
        });                  
        $.ajax({
        url : 'UpdateLink.php',
        data : id,
        type : 'POST',
        dataType : 'json',
        success : function(resp) {
            alert(resp);
        },
        error : function() {
            alert('There was a problem');
        }
        });
    }
    });
});
HTML and some PHP :
HTML Code:
<ul style="list-style-type: none;" class="drag"><li>
   <input type="hidden" value="sortNO_<?php echo $lingi_sort_no; ?>" />
    <input type="hidden" name="<?php echo $title_id; ?>"><a href="<?php echo $lingi_aadress; ?>"><?php echo $lingi_nimi;?></a>
          </li></ul>
PHP that I want to get updating the database
PHP Code:
foreach($_POST['id'] as $title_id => $order) { 
    
$sql "UPDATE db_links SET title_id = '$title_id' WHERE id = '$order'";
    
mysql_query($sql) or die (mysql_error());

I need to update two values in database: $lingi_sort_no and $title_id. I would appreciate some help