Restoring saved position from MySQL with strange problems

Restoring saved position from MySQL with strange problems

Hi.

I have 3 draggable DIVs. At the end of every Drag-Event, I write the new position to a MySQL-DB.
When reloading the page, I load the last position for every DIV and restore this position on the page.

That´s how I do this:
  1. //Javascript-Function
  2. $(function() {
  3.             $( "#dash1" ).draggable({
  4.                     stop: function(event, ui) {
  5.                     var Stoppos = $(this).position();
  6.                     koolajax.load("content/dashboard/updatecoords.php?dash=dash1&x="+(Stoppos.left)+"&y="+(Stoppos.top),handle_ondone_dashboardAction);
  7.                 }
  8.             });
  9.         });


  1. //PHP updatecoords.php
  2. $sql = "UPDATE dashboard SET ".$_GET["dash"]."w = '".$_GET["w"]."', ".$_GET["dash"]."h = '".$_GET["h"]."' WHERE userID=".$_SESSION["userID"];
  3. $resource = mysql_query($sql,$DB);
When reloading the page, that happes:
  1. $sql = "SELECT * FROM dashboard WHERE userID=631";
  2. $resource = mysql_query($sql,$DB);
  3. for($i = 1; $i <= 3; $i++)
  4. {
  5.     if($dashSettings["dash".$i."c"] <> "empty")
  6.     {
  7.         echo '<div style="z-index: '.$zindex.'; left:'.$dashSettings["dash".$i."x"].'px; top:'.$dashSettings["dash".$i."y"].'px; postition: absolute;" class="scrollY ui-widget-content" id="dash'.$i.'">';
  8.             echo "Content of the DIV";
  9.         echo '</div>';
  10.     }
  11. }
But the strange behaviour is:
When setting the position of all three DIVs to exactly the same values (IMG1), they arent positioned correctly (IMG2). Please see the following screenshots, to see, what I mean:

IMG1


IMG2


The 2nd DIV is displaced exactly by the height of the 1st DIV and the 3rd DIV is displaced by the height of the 2nd DIV. For debugging I inserted the DIV-definition into the first line of the DIV-content... you can see it in the IMG2.

But it´s getting stranger:
When now resizing the 1st DIV (via jQueryUI) the 2nd und the 3rd DIV "hop" to above by the height of the 1st DIV. When resizing the 2nd DIV as well, the 3rd DIV hops to above by the height of the 2nd DIV.

Does anybody was a clue?
I am really distressed about this strange piece of software
Please help!

Regards,
BeSt.RR35