AW: Duplikate löschen
Hallo,
ja ich habe eine Seite mit folgendem Code:
++++++++++++++++++
<script type="text/javascript">
$(document).ready(function()
{
function slideout() {
setTimeout(function() {
$("#debugMess").slideUp("slow", function () {
});
}, 2000);}
$("#debugMess").hide();
$(function() {
$("#customersList").sortable({ placeholder: "customersListHighlight", opacity: 0.5, cursor: 'move', update: function() {
var order = $(this).sortable("serialize") + '&action=updateCustomerPos';
$.post("UpdatePos.php", order, function(theResponse) {
$("#debugMess").html(theResponse);
$("#debugMess").slideDown('slow');
slideout();
});
}
});
$( "#customersList" ).disableSelection();
});
});
</script>
</head>
<body>
<?php
require("inc/db.inc.php");
$showDebugMessage = true;
$q_data = $db->query("SELECT id, CONCAT(tn,' ',title) AS ticket, pos FROM otrsplan ORDER BY pos ASC");
if(mysqli_num_rows($q_data) > 0)
{
echo "<div id=\"wrapper\">\n";
if($showDebugMessage) echo " <div id=\"debugMess\"></div>\n";
echo " <ul id=\"customersList\">\n";
while($r_data = $q_data->fetch_object())
{
echo " <li id=\"recArray_".$r_data->id."\">\n";
echo " <div class=\"customerName\">".$r_data->ticket."</div>\n";
echo " <div class=\"customerName\">".$r_data->pos."</div>\n";
echo " </li>\n";
}
echo " </ul>\n";
echo "</div>";
}
else
{
echo "Es wurde kein Kunde in der Datenbank gefunden";
}
$db->close();
?>
++++++++++++++++++++++++++++++++++++
Diese übergibt die id an das update script
++++++++++++++++++++++++++++++++++++++
<?php
/********************************************************************** ******************
*
Wird aufgerufen wenn die Position eines Eintrages per Drag and Drop veraendert wird. *
*
********************************************************************** ******************/
require("inc/db.inc.php");
require_once("inc/session.php");
$action = $db->real_escape_string($_POST['action']);
$updRecArray = $_POST['recArray'];
$timestamp = time();
$benutzer = $_SESSION['user_id'];
if($action == "updateCustomerPos")
{
$counter = 1;
foreach ($updRecArray as $recordIDValue)
{
$q_update = $db->query("UPDATE otrsplan SET pos = " . $counter . " WHERE id = " . $recordIDValue);
$q_history = $db->query("INSERT INTO otrsplan_history (pos_id, pos, edit_by, edit_time) VALUES ('" . $recordIDValue . "','" . $counter . "','" . $benutzer . "','" . $timestamp . "')");
$counter++;
}
echo $timestamp;
}
$db->Close();
?>
++++++++++++++++++++++++++++++++++++++++++++
|