CREATE TABLE IF NOT EXISTS `stroki` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`client` text NOT NULL,
`position` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
есть скрипт:
<script src="jquery.1.5.1.min.js"></script>
<script src="jquery.tablednd.0.5.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#positions").tableDnD({
onDrop: function(table, row) {
var ordered_items = $.tableDnD.serialize('id');
$('#result').load("save_new_positions.php?" + ordered_items);
}
});
});
</script>
</head>
<body>
<div id="result">The place where the result message is displayed</div>
<table id="positions">
<tr id="1"><td>item 1</td></tr>
<tr id="2"><td>item 2</td></tr>
<tr id="3"><td>item 3</td></tr>
<tr id="4"><td>item 4</td></tr>
<tr id="5"><td>item 5</td></tr>
<tr id="6"><td>item 6</td></tr>
</table>
при перетаскивание данные передаются вот сюда save_new_positions.php
<?php
include("mysql.php");
$positions = $_GET["positions"];
echo 'saved in order: ';
foreach ($positions as $key=>$option) {
echo $option . ', ';
// this is where you can put your SQL query, maybe something like
//$query = 'UPDATE table SET position = '.$key.' WHERE id = '.$option.' LIMIT 1';
//mysql_query($query) or die (mysql_error());
}
?>
вот тут то и есть 3 последние строчки. которые и должны записать текущие положение строки
// this is where you can put your SQL query, maybe something like
//$query = 'UPDATE table SET position = '.$key.' WHERE id = '.$option.' LIMIT 1';
//mysql_query($query) or die (mysql_error());
не могу сообразить какие мне данные заменить на свои
имя таблицы у меня stroki
положение хочу записывать в ячейку position