ich hab jetzt schon viel gesucht, gefunden und es nicht am laufen bekommen.
ich habe hier folgendes script welches das update nicht in der datenbank durchführt.
Code:
<script type="text/javascript"> $(document).ready(function() { $("#cat-list").sortable({ handle : '.handle', update : function () { var order = $('#cat-list').sortable('serialize'); $("#info").load("content/admin/admin.portfolio.cats.update.php?"+order); } }); }); </script>
PHP-Code:
$sql = "SELECT * FROM `portfolio_cats` ORDER BY id ASC";
$abfrageergebnis = mysql_query( $sql );
PHP-Code:
<pre>
<div id="info"></div>
</pre>
<ul id="cat-list">
<?php
while ($datensatz = mysql_fetch_array( $abfrageergebnis )) {
echo'
<li id="catID_' .htmlspecialchars( $datensatz['id'] ). '">
<img src="images/icons/drag_arrow.png" alt="move" width="16" height="16" class="handle" />
<strong>' .htmlspecialchars( $datensatz['cat'] ). '</strong>
<a class="del" href="?sub=admin.portfolio.cats&get=del.entry&id=' .htmlspecialchars( $datensatz['id'] ). '" onclick="return confirm(\'' .htmlspecialchars( $datensatz['cat'] ). ': Löschen?\');"><img src="images/icons/close_mouse.png"></a></li>';
}
?>
</ul>
PHP-Code:
include '../../_config/config.inc.php';
include '../../_config/funktions.inc.php';
foreach ($_GET['catID'] as $position => $item) :
$sql[] = "UPDATE portfolio_cats SET id = '$position' WHERE id = '$item'";
endforeach;
print_r($sql);
PHP-Code:
Array
(
[0] => UPDATE portfolio_cats SET id = '0' WHERE id = '1'
[1] => UPDATE portfolio_cats SET id = '1' WHERE id = '2'
[2] => UPDATE portfolio_cats SET id = '2' WHERE id = '0'
[3] => UPDATE portfolio_cats SET id = '3' WHERE id = '3'
[4] => UPDATE portfolio_cats SET id = '4' WHERE id = '4'
[5] => UPDATE portfolio_cats SET id = '5' WHERE id = '7'
)
Einen Kommentar schreiben: