使用Mysql更新已连接的可排序列表
我正在研究一些教程。 我一直在四处寻找,似乎无法击中头部。 到目前为止,这是我的代码。
指数
<?php $result = mysql_query("SELECT MAX(listid) AS listid FROM testtable"); while($row = mysql_fetch_array($result)) { for ($i=1; $i List <li class="ui-state-default" id="recordsArray_">
使用Javascript
$(document).ready(function(){ $(function () { $(".sortable").sortable({ connectWith: ".connectedSortable", distance: 5, zIndex: 0, opacity: 0.6, cursor: 'move', update: function() { var order = $(this).sortable("serialize") + '&action=updateRecordsListings'; $.post("updateDB.php", order)} }).disableSelection(); }); });
和updateDB.php代码
现在一切似乎都很好。 但我想要实现的是当我将列表项移动到连接列表时,更新数据库以反映新列表中的项位置。 目前它只是在其原始列表中更新其位置。
我对这一切都很陌生,所以任何帮助都会很棒! 提前致谢。
我的表看起来像这样:
+----------+----------+---------+--------+ | linkname | linkid | posid | listid | +----------+----------+---------+--------+ | 1 | 1 | 2 | 1 | | 1 | 2 | 1 | 1 | | 1 | 3 | 1 | 2 | | 1 | 4 | 2 | 2 | +----------+----------+---------+--------+