saving new position of table row jquery ui sortable, MySQL
===

i want to allows users to sort table rows derived from database and save the new location in database
**the problem is that the postion is not updated in the interface nither in the database**
mysql table: `id int primary key auto_increment, sort int, author_affliation varchar, author_email varchar`

script: 

    $('#myTable tbody').sortable({
                        start: function (event, ui) {
                            //fix firefox position issue when dragging.
                            if (navigator.userAgent.toLowerCase().match(/firefox/) && ui.helper !== undefined) {
                                ui.helper.css('position', 'absolute').css('margin-top', $(window).scrollTop());
                                //wire up event that changes the margin whenever the window scrolls.
                                $(window).bind('scroll.sortableplaylist', function () {
                                    ui.helper.css('position', 'absolute').css('margin-top', $(window).scrollTop());
                                });
                            }
                        },
                        beforeStop: function (event, ui) {
                            //undo the firefox fix.
                            if (navigator.userAgent.toLowerCase().match(/firefox/) && ui.offset !== undefined) {
                                $(window).unbind('scroll.sortableplaylist');
                                ui.helper.css('margin-top', 0);
                            }
                        },
                        helper: function (e, ui) {
                            ui.children().each(function () {
                                $(this).width($(this).width());
                            });
                            return ui;
                        },
                        scroll: true,
                        update: function (event, ui) {
                            serial = $(this).sortable('serialize');
                            $.ajax({
                                url: "sort_coauthors.php",
                                type: "POST",
                                data: serial,
                                success: function(response) {
                                  alert(response);
                                },
                                error: function(){
                                    alert("theres an error with AJAX");
                                }
                            });
                        }
                    }).disableSelection();
sort-coauthors: 

    @mysql_connect("localhost", "root", "") or die(mysql_error());
    mysql_select_db("mydb") or die(mysql_error());
    
    if (isset($_POST['menu']) && is_array( $_POST['menu'])) {
    $menu = $_POST['menu'];
    for ($i = 0; $i < count($menu); $i++) {
        $q = mysql_query("UPDATE `co_authors` SET `sort`=" . $i . " WHERE `id`='" . intval($menu[$i]) . "'") or die(mysql_error());
    if($q) {
        echo "success";
    }
    }
    }
    else {
        echo "fail";
    }

main page: 
 

    while ($row = mysql_fetch_assoc($co_authors)) {
    
                        echo "<tbody><tr id='menu_" . $row['id'] . "'><td>{$row['author_email']}</td>
                         <td>{$row['coauthor_affliation']}</td>";
                        ?><td><button class='remove' id='remove' name='remove' email="<?php echo $row['author_email'] ?>"
                                paper="<?php echo $row['paper_id'] ?>">Remove</button></td>

