Sortable Portlet Update Query
<p>I am attempting to update some sortable divs that are connected with <code>connectwith</code>.  I have done a single table before and the update query works, but when mutiple divs are involved it gets tricky.  The problem is I have a field in the database called <code>div</code> that needs to update as well with whatever div the sortable object is getting dropped into AS WELL AS put it in a specific order within that div.</p>

<p>EDIT: SOOO, how can I create a sortable update query for multiple div.id locations?</p>

<p>The results I am getting from the code work for just updating the order inside one div, but across multiple divs there is no update.  Plus, I'm not exactly sure of the easiest way to find the div I moved the content to and save that to the database.</p>

<p>Okay, so here's the code I have so far for just updating the order within one div:</p>

<pre><code>$(".heriyah").sortable({ 
    handle : '.handle',
    connectWith: ".heriyah",
    revert: "invalid",
    update : function () { 
        var order = $('.heriyah').sortable('serialize'); 
        $("#info").load("admin/sortable.php?"+order); 
    } 
});
</code></pre>

<p>And the PHP:</p>

<pre><code>foreach ($_GET['listItem'] as $position =&gt; $item) : 
    $sql[] = "UPDATE `temp` SET `order` = $position WHERE `id` = $item"; 
endforeach; 
print_r ($sql); 
</code></pre>

<p>And the HTML/PHP to produce the content (using alot of PHP and JQuery):</p>

<pre><code>&lt;script type="text/javascript"&gt;
(function() {
    $('div.heriyah').each(function() { 
    $(this).html('&lt;div class="add"&gt;&lt;div id="add_button_container"&gt;&lt;div id="add_button" class="edit_links"&gt;+ ADD NEW CONTENT&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="clear"&gt;&lt;/div&gt;&lt;div class="placeable" style="height:20px;background-color:#fff;"&gt;&lt;/div&gt;&lt;/div&gt;');

    var curID = $(this).attr('id');//get the id before you go into fallr

$('.add').click(function() {
$.fallr('show', {
    content     :  '&lt;iframe width="620" height="600" src="&lt;? echo $URL ?&gt;/manage_content.php?pageID=&lt;? echo $pageID; ?&gt;&amp;div='+ curID +'"&gt;&lt;/iframe&gt;',
    width       : 620 + 5, // 100 = for width padding
    height         : 600,
    closeKey        : true,
    closeOverlay    : true,
    buttons     : {}
    }); 
 });    
}); 
})();
&lt;?
include_once('system/js/dbc.php');
$pageID = $_REQUEST['pageID'];
$getdiv2 = mysql_query("SELECT * FROM temp WHERE pageID = '$pageID' ORDER BY `order` ASC");
while ($row = mysql_fetch_assoc($getdiv2)) 
 {
   echo "$('#{$row['div']}.heriyah').append('&lt;div class=sortable id=listItem_{$row['id']}&gt;&lt;div id=heriyah_content class=sortable_header&gt;{$row['title']}&lt;br&gt;{$row['maintext']}&lt;div id=heriyah_handle class=handle&gt;&lt;/div&gt;&lt;a onClick=edit_{$row['id']}();return false&gt;&lt;div id=heriyah_content_hover&gt;&lt;/div&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;');\n";
 }
?&gt;
&lt;/script&gt;
&lt;script&gt;
$(".heriyah").sortable({ 
    handle : '.handle',
    connectWith: ".heriyah",
    revert: "invalid",
    update : function () { 
    var order = $('.heriyah').sortable('serialize'); 
    $("#info").load("admin/sortable.php?"+order); 
  } 
});
&lt;/script&gt;
&lt;div id="info"&gt;&lt;/div&gt; 
</code></pre>
