How do I know to which block the user is drag with Sortable Lists?

How do I know to which block the user is drag with Sortable Lists?

Hello,

I have an example at http://www.familiekant.nl/toernooimaker/club/drag.php

I have a few users which I want to divide into 2 (or more) poule.

I can drag and drop these users with the plugin sortible-list but how can I make the change in the mysql database when a user is released in a poule? So when eg user Arie Thuis was released in poule 1, the record of Arie Thuis must have updated the number '1' in the column poule.

I have a user table with a column poule and a poule table with the ID of the poule.

The JQuery is
  1. <script type="text/javascript">
    $(document).ready(function () {
        $('#poule-indeling .sortable-list').sortable({
            connectWith: '#poule-indeling .sortable-list',
            placeholder: 'placeholder',
            update: function() {
                var order = $(this).sortable("serialize") + '&update=update';
                $.post("drag-updatedata.php", order, function(theResponse) {
          });
            }        
        });                    
    });
    </script>












And the code for drag-updatedata.php is
  1. $array = $_POST['arrayorder'];
     
    if ($_POST['update'] == "update") {
        global $dbh;
        $count = 1;

        foreach ($array as $idval) {
            $query = $dbh->query("UPDATE deelnemers SET poule = " . $count . " WHERE user_id = " . $idval) or die('Error, insert query failed');
            $count ++;    
        }
    }











Any idea how this can be done?

Kind regards,

Arie